protected override ISqlDatabaseManagement CreateChannel() { // If ShareChannel is set by a unit test, use the same channel that // was passed into out constructor. This allows the test to submit // a mock that we use for all network calls. if (ShareChannel) { return(Channel); } if (this.ServiceBinding == null) { this.ServiceBinding = ConfigurationConstants.WebHttpBinding(this.MaxStringContentLength); } if (string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint)) { this.ServiceEndpoint = ConfigurationConstants.ServiceManagementEndpoint; } else { this.ServiceEndpoint = CurrentSubscription.ServiceEndpoint; } return(SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel(this.ServiceBinding, new Uri(this.ServiceEndpoint), CurrentSubscription.Certificate, this.clientRequestId)); }
/// <summary> /// Creates new instance from ServiceBusClientExtensions /// </summary> /// <param name="subscription"></param> /// <param name="logger">The logger action</param> public ServiceBusClientExtensions(SubscriptionData subscription, Action <string> logger = null) { subscriptionId = subscription.SubscriptionId; Subscription = subscription; Logger = logger; ServiceBusManagementChannel = ChannelHelper.CreateServiceManagementChannel <IServiceBusManagement>( ConfigurationConstants.WebHttpBinding(), new Uri(subscription.ServiceEndpoint), subscription.Certificate, new HttpRestMessageInspector(logger)); }
protected override IServiceManagement CreateChannel() { if (ServiceBinding == null) { ServiceBinding = ConfigurationConstants.WebHttpBinding(); } ServiceEndpoint = string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint) ? ConfigurationConstants.ServiceManagementEndpoint : CurrentSubscription.ServiceEndpoint; return(ServiceManagementHelper.CreateServiceManagementChannel(ServiceBinding, new Uri(ServiceEndpoint), CurrentSubscription.Certificate)); }
/// <summary> /// Creates a channel for communication with the server. /// </summary> /// <returns>a new channel to use for communication</returns> private ISqlDatabaseManagement GetManagementChannel() { if (this.Channel == null) { //create a channel to the server for communication ISqlDatabaseManagement channel = SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel( ConfigurationConstants.WebHttpBinding(ConfigurationConstants.MaxStringContentLength), this.serviceEndpoint, this.certificate, this.clientRequestId); this.Channel = channel; } return(this.Channel); }
protected override IGatewayServiceManagement CreateChannel() { if (base.get_ServiceBinding() == null) { base.set_ServiceBinding(ConfigurationConstants.WebHttpBinding()); } if (!string.IsNullOrEmpty(base.get_CurrentSubscription().get_ServiceEndpoint())) { base.set_ServiceEndpoint(base.get_CurrentSubscription().get_ServiceEndpoint()); } else { base.set_ServiceEndpoint("https://management.core.windows.net"); } return(GatewayManagementHelper.CreateGatewayManagementChannel(base.get_ServiceBinding(), new Uri(base.get_ServiceEndpoint()), base.get_CurrentSubscription().get_Certificate())); }
/// <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; Logger = logger; WebsiteChannel = ServiceManagementHelper.CreateServiceManagementChannel <IWebsitesServiceManagement>( ConfigurationConstants.WebHttpBinding(), new Uri(subscription.ServiceEndpoint), subscription.Certificate, new HttpRestMessageInspector(logger)); ServiceManagementChannel = ServiceManagementHelper.CreateServiceManagementChannel <IServiceManagement>( ConfigurationConstants.WebHttpBinding(), new Uri(subscription.ServiceEndpoint), subscription.Certificate, new HttpRestMessageInspector(logger)); }
/// <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(); }
/// <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(); }
/// <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); }