Esempio n. 1
0
        internal async Task CreateAsync(CloudService parent, Uri packageUrl, CreationOptions options = null)
        {
            Contract.Requires(parent != null);
            Contract.Requires(packageUrl != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(Label));
            Contract.Requires(Configuration != null);

            if (options == null)
            {
                options = new CreationOptions();
            }
            var ns      = XmlNamespaces.WindowsAzure;
            var content = new XElement(ns + "CreateDeployment",
                                       new XElement(ns + "Name", Name),
                                       new XElement(ns + "PackageUrl", packageUrl.ToString()),
                                       new XElement(ns + "Label", Label.ToBase64String()),
                                       new XElement(ns + "Configuration", Configuration.ToXml().ToString().ToBase64String()),
                                       new XElement(ns + "StartDeployment", options.StartDeployment),
                                       new XElement(ns + "TreatWarningsAsError", options.TreatWarningsAsError)
                                       );

            HttpResponseMessage response = await GetRestClient(parent).PostAsync(content);

            await parent.Subscription.WaitForOperationCompletionAsync(response);

            Parent = parent;
        }
Esempio n. 2
0
        public async Task DeleteAsync()
        {
            Contract.Requires(Parent != null);
            await Parent.Subscription.WaitForOperationCompletionAsync(await GetRestClient("/" + ThumbprintAlgorithm + "-" + Thumbprint).DeleteAsync());

            Parent = null;
        }
Esempio n. 3
0
        public async Task DeleteAsync()
        {
            Contract.Requires(Parent != null);
            await Parent.Subscription.WaitForOperationCompletionAsync(await GetRestClient().DeleteAsync());

            Parent = null;
        }
Esempio n. 4
0
        internal Deployment(XElement element, CloudService parent)
            : this()
        {
            Contract.Requires(element != null);
            Contract.Requires(parent != null);

            Parent = parent;
            PopulateFromXml(element);
        }
Esempio n. 5
0
        public async Task DeleteAsync()
        {
            Contract.Requires(Parent != null);
            var httpResponseMessage = await GetRestClient(Parent, "/" + Id).DeleteAsync();

            await Parent.Subscription.WaitForOperationCompletionAsync(httpResponseMessage);

            Parent = null;
        }
Esempio n. 6
0
        AzureRestClient GetRestClient(CloudService cloudService, string pathSuffix = null)
        {
            string servicePath = "services/hostedservices/" + cloudService.Name + "/deploymentslots/" + Slot.ToString().ToLowerInvariant();

            if (!string.IsNullOrEmpty(pathSuffix))
            {
                servicePath += pathSuffix;
            }
            return(cloudService.Subscription.GetCoreRestClient20131101(servicePath));
        }
Esempio n. 7
0
        AzureRestClient GetRestClient(CloudService parent, string pathSuffix = null)
        {
            string servicePath = "services/hostedServices/" + parent.Name + "/certificates";

            if (pathSuffix != null)
            {
                servicePath += pathSuffix;
            }
            return(parent.Subscription.GetCoreRestClient20120301(servicePath));
        }
Esempio n. 8
0
        public ServiceCertificate(XElement element, CloudService parent)
        {
            var ns = XmlNamespaces.WindowsAzure;

            Uri                 = new Uri((string)element.Element(ns + "CertificateUrl"));
            Thumbprint          = (string)element.Element(ns + "Thumbprint");
            ThumbprintAlgorithm = (string)element.Element(ns + "ThumbprintAlgorithm");
            Certificate         = new X509Certificate2(Convert.FromBase64String((string)element.Element(ns + "Data")));
            Parent              = parent;
        }
Esempio n. 9
0
        public Extension(XElement xml, CloudService parent)
        {
            Contract.Requires(parent != null);

            xml.HydrateObject(XmlNamespaces.WindowsAzure, this);

            PublicConfiguration  = PublicConfiguration.FromBase64String();
            PrivateConfiguration = PrivateConfiguration.FromBase64String();

            Parent = parent;
        }
Esempio n. 10
0
        internal async Task AddAsync(CloudService parent)
        {
            var ns = XmlNamespaces.WindowsAzure;

            var content = new XElement(ns + "Extension", BuildExtensionXml(ns).ToArray());

            var response = await GetRestClient(parent).PostAsync(content);

            await parent.Subscription.WaitForOperationCompletionAsync(response);

            Parent = parent;
        }
Esempio n. 11
0
        private static AzureRestClient GetRestClient(
            CloudService parent,
            string pathSuffix = null)
        {
            var servicePath = "services/hostedServices/" + parent.Name + "/extensions";

            if (pathSuffix != null)
            {
                servicePath += pathSuffix;
            }
            return(parent.Subscription.GetCoreRestClient20140601(servicePath));
        }
Esempio n. 12
0
        internal async Task AddAsync(CloudService parent)
        {
            var ns      = XmlNamespaces.WindowsAzure;
            var content = new XElement(ns + "CertificateFile",
                                       new XElement(ns + "Data", Convert.ToBase64String(Certificate.Export(X509ContentType.Pfx))),
                                       new XElement(ns + "CertificateFormat", "pfx"),
                                       new XElement(ns + "Password"));

            HttpResponseMessage response = await GetRestClient(parent).PostAsync(content);

            await parent.Subscription.WaitForOperationCompletionAsync(response);

            Parent = parent;
        }