Esempio n. 1
0
 /// <summary>
 /// Creates new instance from CloudServiceClient.
 /// </summary>
 /// <param name="subscription">The subscription data</param>
 /// <param name="debugStream">Action used to log http requests/responses</param>
 /// <param name="verboseStream">Action used to log detailed client progress</param>
 /// <param name="warningStream">Action used to log warning messages</param>
 public CloudServiceClient(
     SubscriptionData subscription,
     string currentLocation        = null,
     Action <string> debugStream   = null,
     Action <string> verboseStream = null,
     Action <string> warningStream = null)
 {
     Subscription             = subscription;
     subscriptionId           = subscription.SubscriptionId;
     CurrentDirectory         = currentLocation;
     DebugStream              = debugStream;
     VerboseStream            = verboseStream;
     WarningeStream           = warningStream;
     HeadersInspector         = new HeadersInspector();
     ServiceManagementChannel = ServiceManagementHelper.CreateServiceManagementChannel <IServiceManagement>(
         ConfigurationConstants.WebHttpBinding(),
         new Uri(subscription.ServiceEndpoint),
         subscription.Certificate,
         new HttpRestMessageInspector(DebugStream),
         HeadersInspector);
     CloudBlobUtility = new CloudBlobUtility();
 }
Esempio n. 2
0
        /// <summary>
        /// Creates new instance from the store client.
        /// </summary>
        /// <param name="subscriptionId">The Windows Azure subscription id</param>
        /// <param name="storeEndpointUri">The service management endpoint uri</param>
        /// <param name="cert">The authentication certificate</param>
        /// <param name="logger">The logger for http request/response</param>
        /// <param name="serviceManagementChannel">The service management channel</param>
        public StoreClient(
            string subscriptionId,
            string storeEndpointUri,
            X509Certificate2 cert,
            Action <string> logger,
            IServiceManagement serviceManagementChannel)
        {
            Validate.ValidateStringIsNullOrEmpty(storeEndpointUri, null, true);
            Validate.ValidateStringIsNullOrEmpty(subscriptionId, null, true);
            Validate.ValidateNullArgument(cert, Resources.NullCertificateMessage);

            this.subscriptionId = subscriptionId;
            headersInspector    = new HeadersInspector();
            storeChannel        = ServiceManagementHelper.CreateServiceManagementChannel <IStoreManagement>(
                ConfigurationConstants.WebHttpBinding(0),
                new Uri(storeEndpointUri),
                cert,
                new HttpRestMessageInspector(logger),
                headersInspector);
            this.serviceManagementChannel = serviceManagementChannel;
            MarketplaceClient             = new MarketplaceClient();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates new WebsitesClient.
        /// </summary>
        /// <param name="subscription">The Windows Azure subscription data object</param>
        /// <param name="logger">The logger action</param>
        public WebsitesClient(SubscriptionData subscription, Action <string> logger)
        {
            subscriptionId   = subscription.SubscriptionId;
            Subscription     = subscription;
            Logger           = logger;
            HeadersInspector = new HeadersInspector();
            HeadersInspector.RequestHeaders.Add(ServiceManagement.Constants.VersionHeaderName, WebsitesServiceVersion);
            HeadersInspector.RequestHeaders.Add(ApiConstants.UserAgentHeaderName, ApiConstants.UserAgentHeaderValue);
            HeadersInspector.RemoveHeaders.Add(ApiConstants.VSDebuggerCausalityDataHeaderName);
            WebsiteChannel = ChannelHelper.CreateChannel <IWebsitesServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                HeadersInspector,
                new HttpRestMessageInspector(logger));

            ServiceManagementChannel = ChannelHelper.CreateServiceManagementChannel <IServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                new HttpRestMessageInspector(logger));

            cloudServiceClient = new CloudServiceClient(subscription, debugStream: logger);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates new instance from the store client.
        /// </summary>
        /// <param name="subscriptionId">The Windows Azure subscription id</param>
        /// <param name="storeEndpointUri">The service management endpoint uri</param>
        /// <param name="cert">The authentication certificate</param>
        /// <param name="logger">The logger for http request/response</param>
        /// <param name="serviceManagementChannel">The service management channel</param>
        public StoreClient(
            string subscriptionId,
            string storeEndpointUri,
            X509Certificate2 cert,
            Action<string> logger,
            IServiceManagement serviceManagementChannel)
        {
            Validate.ValidateStringIsNullOrEmpty(storeEndpointUri, null, true);
            Validate.ValidateStringIsNullOrEmpty(subscriptionId, null, true);
            Validate.ValidateNullArgument(cert, Resources.NullCertificateMessage);

            this.subscriptionId = subscriptionId;
            headersInspector = new HeadersInspector();
            storeChannel = ChannelHelper.CreateServiceManagementChannel<IStoreManagement>(
                ConfigurationConstants.WebHttpBinding(0),
                new Uri(storeEndpointUri),
                cert,
                new HttpRestMessageInspector(logger),
                headersInspector);
            this.serviceManagementChannel = serviceManagementChannel;
            MarketplaceClient = new MarketplaceClient();
        }