コード例 #1
0
        public static void UpdateStorageAccount(this IServiceManagement proxy, string subscriptionId, string storageAccountName, string label, string description)
        {
            var input = new UpdateStorageServiceInput()
            {
                Label       = ServiceManagementHelper.EncodeToBase64String(label),
                Description = description
            };

            proxy.EndUpdateStorageAccount(proxy.BeginUpdateStorageAccount(subscriptionId, storageAccountName, input, null, null));
        }
コード例 #2
0
        protected override IServiceManagement CreateChannel()
        {
            if (this.ServiceBinding == null)
            {
                this.ServiceBinding = ConfigurationConstants.WebHttpBinding(this.MaxStringContentLength);
            }

            if (string.IsNullOrEmpty(this.ServiceEndpoint))
            {
                this.ServiceEndpoint = ConfigurationConstants.ServiceManagementEndpoint;
            }

            return(ServiceManagementHelper.CreateServiceManagementChannel(this.ServiceBinding, new Uri(this.ServiceEndpoint), this.certificate));
        }
コード例 #3
0
        protected virtual void WriteErrorDetails(CommunicationException exception)
        {
            ServiceManagementError error = null;

            ServiceManagementHelper.TryGetExceptionDetails(exception, out error);

            if (error == null)
            {
                SafeWriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
            }
            else
            {
                string errorDetails = string.Format(
                    CultureInfo.InvariantCulture,
                    "HTTP Status Code: {0} - HTTP Error Message: {1}",
                    error.Code,
                    error.Message);

                SafeWriteError(new ErrorRecord(new CommunicationException(errorDetails), string.Empty, ErrorCategory.CloseError, null));
            }
        }
コード例 #4
0
        public DeploymentInfoContext(Deployment innerDeployment)
        {
            this.innerDeployment = innerDeployment;

            if (this.innerDeployment.RoleInstanceList != null)
            {
                this.RoleInstanceList = new List <AzureDeploymentCmdlets.Concrete.RoleInstance>();
                foreach (var roleInstance in this.innerDeployment.RoleInstanceList)
                {
                    this.RoleInstanceList.Add(new AzureDeploymentCmdlets.Concrete.RoleInstance(roleInstance));
                }
            }

            if (!string.IsNullOrEmpty(this.innerDeployment.Configuration))
            {
                string xmlString = ServiceManagementHelper.DecodeFromBase64String(this.innerDeployment.Configuration);

                XDocument doc = null;
                using (var stringReader = new StringReader(xmlString))
                {
                    XmlReader reader = XmlReader.Create(stringReader);
                    doc = XDocument.Load(reader);
                }

                this.OSVersion = doc.Root.Attribute("osVersion") != null?
                                 doc.Root.Attribute("osVersion").Value:
                                 string.Empty;

                this.RolesConfiguration = new Dictionary <string, RoleConfiguration>();

                var roles = doc.Root.Descendants(this.ns + "Role");

                foreach (var role in roles)
                {
                    this.RolesConfiguration.Add(role.Attribute("name").Value, new RoleConfiguration(role));
                }
            }
        }
コード例 #5
0
ファイル: Utility.cs プロジェクト: woloski/azure-sdk-tools
        public static string GetConfiguration(string configurationPath)
        {
            var configuration = string.Join(string.Empty, File.ReadAllLines(configurationPath));

            return(ServiceManagementHelper.EncodeToBase64String(configuration));
        }