protected override void ProcessRecord() { ServiceManagementProfile.Initialize(); var dnsUpdateParameters = new DNSUpdateParameters() { 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.UpdateDNSServer( this.ServiceName, deploymentName, dnsUpdateParameters.Name, dnsUpdateParameters); }); }
/// <summary> /// Updates a definition for an existing DNS server. Updates to address /// is the only change allowed. DNS server name cannot be changed /// </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='dnsServerName'> /// Required. The name of the dns server. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update 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> UpdateDNSServerAsync(this IDNSServerOperations operations, string serviceName, string deploymentName, string dnsServerName, DNSUpdateParameters parameters) { return operations.UpdateDNSServerAsync(serviceName, deploymentName, dnsServerName, parameters, CancellationToken.None); }
/// <summary> /// Updates a definition for an existing DNS server. Updates to address /// is the only change allowed. DNS server name cannot be changed /// </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='dnsServerName'> /// Required. The name of the dns server. /// </param> /// <param name='parameters'> /// Required. Parameters supplied to the Update 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 UpdateDNSServer(this IDNSServerOperations operations, string serviceName, string deploymentName, string dnsServerName, DNSUpdateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IDNSServerOperations)s).UpdateDNSServerAsync(serviceName, deploymentName, dnsServerName, parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
protected PSArgument[] CreateDNSServerUpdateDNSServerParameters() { string serviceName = string.Empty; string deploymentName = string.Empty; string dnsServerName = string.Empty; DNSUpdateParameters parameters = new DNSUpdateParameters(); return ConvertFromObjectsToArguments(new string[] { "ServiceName", "DeploymentName", "DnsServerName", "Parameters" }, new object[] { serviceName, deploymentName, dnsServerName, parameters }); }