Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.PersistentVMs.NewAzureVMCommand.DoesCloudServiceExist C# (CSharp) Method

DoesCloudServiceExist() protected method

protected DoesCloudServiceExist ( string serviceName ) : bool
serviceName string
return bool
        protected bool DoesCloudServiceExist(string serviceName)
        {
            bool isPresent = false;
            using (new OperationContextScope(Channel.ToContextChannel()))
            {
                try
                {
                    AvailabilityResponse response = this.RetryCall(s => this.Channel.IsDNSAvailable(s, serviceName));
                    WaitForOperation(CommandRuntime.ToString(), true);
                    isPresent = !response.Result;
                }
                catch (ServiceManagementClientException ex)
                {
                    if (ex.HttpStatus == HttpStatusCode.NotFound)
                    {
                        isPresent = false;
                    }
                    else
                    {
                        this.WriteErrorDetails(ex);
                    }
                }
            }

            return isPresent;
        }