public override void ExecuteCmdlet() { base.ExecuteCmdlet(); if (Service.IsPresent) { IsDNSAvailable(CurrentSubscription.SubscriptionId, Name); } else if (Storage.IsPresent) { IsStorageServiceAvailable(CurrentSubscription.SubscriptionId, Name); } else { if (serviceBusChannel == null) { serviceBusChannel = ChannelHelper.CreateServiceManagementChannel <IServiceBusManagement>( ServiceBinding, new Uri(ServiceEndpoint), CurrentSubscription.Certificate, new HttpRestMessageInspector(text => this.WriteDebug(text))); } IsServiceBusNamespaceAvailable(CurrentSubscription.SubscriptionId, Name); } }
/// <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 IDeploymentServiceManagement CreateDeploymentChannel(Repository repository) { // 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(DeploymentChannel); } return(ChannelHelper.CreateServiceManagementChannel <IDeploymentServiceManagement>( new Uri(repository.RepositoryUri), repository.PublishingUsername, repository.PublishingPassword, new HttpRestMessageInspector(WriteDebug))); }
/// <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 = ChannelHelper.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 = ChannelHelper.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); }