/// <summary> /// Add a definition for a DNS server to an existing deployment. VM's /// in this deployment will be programmed to use this DNS server for /// all DNS resolutions /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IDNSServerOperations. /// </param> /// <param name='serviceName'> /// Required. The name of the service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Add DNS Server operation. /// </param> /// <returns> /// The response body contains the status of the specified asynchronous /// operation, indicating whether it has succeeded, is inprogress, or /// has failed. Note that this status is distinct from the HTTP status /// code returned for the Get Operation Status operation itself. If /// the asynchronous operation succeeded, the response body includes /// the HTTP status code for the successful request. If the /// asynchronous operation failed, the response body includes the HTTP /// status code for the failed request and error information regarding /// the failure. /// </returns> public static OperationStatusResponse AddDNSServer(this IDNSServerOperations operations, string serviceName, string deploymentName, DNSAddParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IDNSServerOperations)s).AddDNSServerAsync(serviceName, deploymentName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
protected override void ProcessRecord() { ServiceManagementProfile.Initialize(); var dnsAddParameters = new DNSAddParameters { Address = this.IPAddress, Name = this.Name }; ExecuteClientActionNewSM(null, CommandRuntime.ToString(), () => { var deploymentName = this.ComputeClient.Deployments.GetBySlot( this.ServiceName, DeploymentSlot.Production).Name; return this.ComputeClient.DnsServer.AddDNSServer( this.ServiceName, deploymentName, dnsAddParameters); }); }
/// <summary> /// Add a definition for a DNS server to an existing deployment. VM's /// in this deployment will be programmed to use this DNS server for /// all DNS resolutions /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Compute.IDNSServerOperations. /// </param> /// <param name='serviceName'> /// Required. The name of the service. /// </param> /// <param name='deploymentName'> /// Required. The name of the deployment. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Add DNS Server operation. /// </param> /// <returns> /// The response body contains the status of the specified asynchronous /// operation, indicating whether it has succeeded, is inprogress, or /// has failed. Note that this status is distinct from the HTTP status /// code returned for the Get Operation Status operation itself. If /// the asynchronous operation succeeded, the response body includes /// the HTTP status code for the successful request. If the /// asynchronous operation failed, the response body includes the HTTP /// status code for the failed request and error information regarding /// the failure. /// </returns> public static Task<OperationStatusResponse> BeginAddingDNSServerAsync(this IDNSServerOperations operations, string serviceName, string deploymentName, DNSAddParameters parameters) { return operations.BeginAddingDNSServerAsync(serviceName, deploymentName, parameters, CancellationToken.None); }
protected PSArgument[] CreateDNSServerAddDNSServerParameters() { string serviceName = string.Empty; string deploymentName = string.Empty; DNSAddParameters parameters = new DNSAddParameters(); return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentName", "Parameters" }, new object[] { serviceName, deploymentName, parameters }); }