Skip to content

Instantly share code, notes, and snippets.

View nmackenzie's full-sized avatar

Neil Mackenzie nmackenzie

  • Microsoft
  • San Francisco, CA
View GitHub Profile
public void PutMessage(String queueName, String message)
{
String requestMethod = "POST";
String urlPath = String.Format("{0}/messages", queueName);
String storageServiceVersion = "2012-02-12";
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);
String messageText = String.Format(
public void LeaseBlob(String containerName, String blobName)
{
String requestMethod = "PUT";
String urlPath = String.Format("{0}/{1}?comp=lease", containerName, blobName);
String modifiedUrlPath = String.Format("{0}/{1}\ncomp:lease", containerName, blobName);
const Int32 contentLength = 0;
String storageServiceVersion = "2012-02-12";
public void PutBlob(String containerName, String blobName)
{
String requestMethod = "PUT";
String urlPath = String.Format("{0}/{1}", containerName, blobName);
String storageServiceVersion = "2012-02-12";
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);
public void GetEntity(String tableName, String partitionKey, String rowKey)
{
String requestMethod = "GET";
String urlPath = String.Format("{0}(PartitionKey='{1}',RowKey='{2}')", tableName, partitionKey, rowKey);
String storageServiceVersion = "2012-02-12";
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);
String canonicalizedResource = String.Format("/{0}/{1}", AzureStorageConstants.Account, urlPath);
public void InsertEntity(String tableName, String artist, String title)
{
String requestMethod = "POST";
String urlPath = tableName;
String storageServiceVersion = "2012-02-12";
String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture);
String contentMD5 = String.Empty;
public static String CreateAuthorizationHeader(String canonicalizedString) {
String signature = String.Empty;
using (HMACSHA256 hmacSha256 = new HMACSHA256( Convert.FromBase64String(storageAccountKey) )) {
Byte[] dataToHmac = System.Text.Encoding.UTF8.GetBytes(canonicalizedString);
signature = Convert.ToBase64String(hmacSha256.ComputeHash(dataToHmac));
}
String authorizationHeader = String.Format(
CultureInfo.InvariantCulture,
using System;
using System.Collections.Generic;
[EventSource(Name = "MyDomain-MyEventSource")]
public class MyEventSource : EventSource
{
public class Keywords
{
public const EventKeywords Database = (EventKeywords)1;
public const EventKeywords ExternalApi = (EventKeywords)2;
}
@nmackenzie
nmackenzie / AddRoleHeader
Created June 8, 2013 22:22
Sample header for the Add Role operation in the Windows Azure Service Management REST API
POST /MY_SUBSCRIPTION/services/hostedservices/SERVICE_NAME/deployments/DEPLOYMENT_NAME/roles HTTP/1.1
x-ms-version: 2013-06-01
Host: management.core.windows.net
Content-Type: application/xml
@nmackenzie
nmackenzie / CreateVirtualMachineDeploymentHeader
Created June 8, 2013 22:19
Sample header for the Create Virtual Machine deployment in the Windows Azure Service Management REST API
POST /MY_SUBSCRIPTION/services/hostedservices/SERVICE_NAME/deployments HTTP/1.1
x-ms-version: 2013-06-01
Host: management.core.windows.net
Content-Type: application/xml
@nmackenzie
nmackenzie / CreateHostedServicesHeader
Created June 8, 2013 22:17
Sample request header for Create Hosted Services operation in the Windows Azure Service Management REST API
POST /MY_SUBSCRIPTION/services/hostedservices HTTP/1.1
Host: management.core.windows.net
x-ms-version: 2013-06-01
Content-Type: application/xml