Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/12 13:38:48 (12 years ago)
Author:
spimming
Message:

#1680:

  • Storage service operations added:
  • list storage services
  • get keys for storage service
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive.Azure/HeuristicLab.Clients.Hive.CloudManager/3.3/Azure/ServiceManagementOperation.cs

    r7429 r7545  
    108108      else
    109109        return new List<HostedService>();
     110    }
     111
     112    public static List<StorageService> ListStorageServices(string subscriptionId, string thumbprint) {
     113      string uri = string.Format(Constants.URIStorageServiceFormat, subscriptionId);
     114      ServiceWebRequest operation = new ServiceWebRequest(thumbprint);
     115      XDocument response = operation.Invoke(uri);
     116      List<StorageService> result = null;
     117      if (response.Root.HasElements) {
     118        result = (from s in response.Elements()
     119                  select new StorageService() {
     120                    Url = s.Descendants(wa + "Url").Single().Value,
     121                    ServiceName = s.Descendants(wa + "ServiceName").Single().Value
     122                  }).ToList();
     123      }
     124      if (result != null)
     125        return result;
     126      else
     127        return new List<StorageService>();
    110128    }
    111129
     
    170188    }
    171189
     190    public static StorageServiceKeys GetStorageKeys(string subscriptionId, string thumbprint, string serviceName) {
     191      string uri = string.Format(Constants.URIStorageServiceKeys, subscriptionId, serviceName);
     192      ServiceWebRequest operation = new ServiceWebRequest(thumbprint);
     193      XDocument response = operation.Invoke(uri);
     194      StorageServiceKeys keys = new StorageServiceKeys();
     195      keys.Primary = response.Descendants(wa + "Primary").Single().Value;
     196      keys.Secondary = response.Descendants(wa + "Secondary").Single().Value;
     197      return keys;
     198    }
     199
    172200    public static string AddCertificate(string subscriptionId, string thumbprint, string serviceName, string certificateFilePath, string password) {
    173201      string uri = String.Format(Constants.URICertificateFormat, subscriptionId, serviceName);
Note: See TracChangeset for help on using the changeset viewer.