static void Main(string[] args) { if (args.Length < 1) { throw new ArgumentNullException("publish settings informations"); } SubscriptionCloudCredentials cred = GetCredentials(args[0]); //WATM TrafficManagerManagementClient watmClient = new TrafficManagerManagementClient(cred); string atmDns = "adxsdk12345.trafficmanager.net"; DnsPrefixAvailabilityCheckResponse watmResp = watmClient.Profiles.CheckDnsPrefixAvailability("adxsdk12345.trafficmanager.net"); Console.WriteLine("Invoke WATM->CheckDnsPrefixAvailability(\'{0}\'). Result: {1}", atmDns, watmResp.Result); //Compute ComputeManagementClient computeClient = new ComputeManagementClient(cred); string hostServiceName = "adxsdk12345"; HostedServiceCheckNameAvailabilityResponse computeResp = computeClient.HostedServices.CheckNameAvailability(hostServiceName); Console.WriteLine("Invoke Compute->CheckNameAvailability(\'{0}\'). Result: {1}", hostServiceName, computeResp.IsAvailable); //Websites WebSiteManagementClient websiteClient = new WebSiteManagementClient(cred); string webSiteName = "adxsdk12345"; WebSiteIsHostnameAvailableResponse webSiteResp = websiteClient.WebSites.IsHostnameAvailable(webSiteName); Console.WriteLine("Invoke WebSite->IsHostnameAvailable(\'{0}\'). Result: {1}", webSiteName, webSiteResp.IsAvailable); //Scheduler SchedulerManagementClient schedulerClient = new SchedulerManagementClient(cred); string schedulerCloudServiceName = "foobarrr"; string expectedSchedulerException = string.Format( "ResourceNotFound: The cloud service with name {0} was not found.", schedulerCloudServiceName); bool exceptionFromSchedulerServiceOccurred = false; try { schedulerClient.JobCollections.CheckNameAvailability(schedulerCloudServiceName, "doesnotmatter"); } catch (Exception ex) { if (ex.Message == expectedSchedulerException) { exceptionFromSchedulerServiceOccurred = true; Console.WriteLine("Invoke Scheduler->CheckNameAvailability(\'{0}\'). Get back correct exception", schedulerCloudServiceName, expectedSchedulerException); } } if (!exceptionFromSchedulerServiceOccurred) { throw new Exception("we didn't get expected exception message from scheduler service"); } Console.WriteLine("Smoke test is good"); }
public TrafficManagerClient(TrafficManagerManagementClient client) { this.Client = client; }
public TrafficManagerClient(WindowsAzureSubscription subscription) { this.Client = subscription.CreateClient<TrafficManagerManagementClient>(); }
public TrafficManagerClient(AzureProfile profile, AzureSubscription subscription) { this.Client = AzureSession.ClientFactory.CreateClient<TrafficManagerManagementClient>(profile, subscription, AzureEnvironment.Endpoint.ServiceManagement); }