protected void SetupManagementClients()
        {
            CloudServiceManagementClient = GetCloudServicesManagementClient();
            RecoveryServicesMgmtClient = GetRecoveryServicesManagementClient();
            SiteRecoveryMgmtClient = GetSiteRecoveryManagementClient();

            helper.SetupManagementClients(CloudServiceManagementClient, RecoveryServicesMgmtClient, SiteRecoveryMgmtClient);
        }
 public StorSimpleClient(AzureSubscription currentSubscription)
 {
     // Temp code to be able to test internal env.
     ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };//IgnoreCertificateErrorHandler;//delegate { return true; };
     
     this.cloudServicesClient = AzureSession.ClientFactory.CreateClient<CloudServiceManagementClient>(currentSubscription, AzureEnvironment.Endpoint.ServiceManagement);
     
     ResourceCachetimeoutPolicy.AbsoluteExpiration = DateTimeOffset.Now.AddHours(1.0d);
 }
 public void CreateCloudService(SubscriptionCloudCredentials credentials,string cloudServiceName)
 {
     var cloudServiceClient = new CloudServiceManagementClient(credentials);
     var cloudServiceCreateParameters = new CloudServiceCreateParameters
     {
         Description = cloudServiceParameters.Description,
         GeoRegion = cloudServiceParameters.GeoRegion,
         Label = cloudServiceParameters.Label
     };
     cloudServiceClient.CloudServices.Create(cloudServiceName, cloudServiceCreateParameters);
 }
Exemple #4
0
        protected override void Clone(ServiceClient <CloudServiceManagementClient> client)
        {
            base.Clone(client);
            CloudServiceManagementClient management = client as CloudServiceManagementClient;

            if (management != null)
            {
                management._credentials = Credentials;
                management._baseUri     = BaseUri;
                management.Credentials.InitializeServiceClient(management);
            }
        }
        public Program(ScheduledWebJobCreatorParameters parms)
        {
            // auth
            _credential = TokenCredentialHelper<MyPersonalConfiguration>.GetCredentials(
                new MyPersonalConfiguration(parms),
                parms.subscriptionId);

            // create the clients needed
            _cloudServiceManagementClient = CloudContext.Clients.CreateCloudServiceManagementClient(_credential);
            _webSiteMgmtClient = CloudContext.Clients.CreateWebSiteManagementClient(_credential);
            _schedulerMgmtClient = CloudContext.Clients.CreateSchedulerManagementClient(_credential);
        }
        /// <summary>
        /// Creates new Scheduler Management Convenience Client
        /// </summary>
        /// <param name="subscription">Subscription containing websites to manipulate</param>
        public SchedulerMgmntClient(AzureSubscription subscription)
        {
            currentSubscription = subscription;
            csmClient = AzureSession.ClientFactory.CreateClient<CloudServiceManagementClient>(subscription, AzureEnvironment.Endpoint.ServiceManagement);
            schedulerManagementClient = AzureSession.ClientFactory.CreateClient<SchedulerManagementClient>(subscription, AzureEnvironment.Endpoint.ServiceManagement);

            //Get RP properties
            IDictionary<string, string> dict = schedulerManagementClient.GetResourceProviderProperties().Properties;

            //Get available regions
            string val = string.Empty;
            if (dict.TryGetValue(SupportedRegionsKey, out val))
            {
                AvailableRegions = new List<string>();
                val.Split(',').ToList().ForEach(s => AvailableRegions.Add(s));
            }

            //Store global counts for max jobs and min recurrence for each plan     
            if (dict.TryGetValue(FreeMaxJobCountKey, out val))
                FreeMaxJobCountValue = Convert.ToInt32(dict[FreeMaxJobCountKey]);

            if (dict.TryGetValue(FreeMinRecurrenceKey, out val))
                FreeMinRecurrenceValue = TimeSpan.Parse(dict[FreeMinRecurrenceKey]);

            if (dict.TryGetValue(StandardMaxJobCountKey, out val))
                StandardMaxJobCountValue = Convert.ToInt32(dict[StandardMaxJobCountKey]);

            if (dict.TryGetValue(StandardMinRecurrenceKey, out val))
                StandardMinRecurrenceValue = TimeSpan.Parse(dict[StandardMinRecurrenceKey]);

            if (dict.TryGetValue(PremiumMaxJobCountKey, out val))
                PremiumMaxJobCountValue = Convert.ToInt32(dict[PremiumMaxJobCountKey]);

            if (dict.TryGetValue(PremiumMinRecurrenceKey, out val))
                PremiumMinRecurrenceValue = TimeSpan.Parse(dict[PremiumMinRecurrenceKey]);
        }
 /// <summary>
 /// Creates new Scheduler Management Convenience Client
 /// </summary>
 /// <param name="subscription">Subscription containing websites to manipulate</param>
 public SchedulerMgmntClient(WindowsAzureSubscription subscription)
 {
     csmClient = subscription.CreateClient<CloudServiceManagementClient>();
     schedulerManagementClient = subscription.CreateClient<SchedulerManagementClient>();
 }