public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Route53.Model.CreateTrafficPolicyVersionRequest(); if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } if (cmdletContext.Document != null) { request.Document = cmdletContext.Document; } if (cmdletContext.Comment != null) { request.Comment = cmdletContext.Comment; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
private Amazon.Route53.Model.CreateTrafficPolicyVersionResponse CallAWSServiceOperation(IAmazonRoute53 client, Amazon.Route53.Model.CreateTrafficPolicyVersionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Route 53", "CreateTrafficPolicyVersion"); try { #if DESKTOP return(client.CreateTrafficPolicyVersion(request)); #elif CORECLR return(client.CreateTrafficPolicyVersionAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Creates a new version of an existing traffic policy. When you create a new version /// of a traffic policy, you specify the ID of the traffic policy that you want to update /// and a JSON-formatted document that describes the new version. You use traffic policies /// to create multiple DNS resource record sets for one domain name (such as example.com) /// or one subdomain name (such as www.example.com). You can create a maximum of 1000 /// versions of a traffic policy. If you reach the limit and need to create another version, /// you'll need to start a new traffic policy. /// /// /// <para> /// Send a <code>POST</code> request to the <code>/2013-04-01/trafficpolicy/</code> resource. /// The request body includes a document with a <code>CreateTrafficPolicyVersionRequest</code> /// element. The response returns the <code>CreateTrafficPolicyVersionResponse</code> /// element, which contains information about the new version of the traffic policy. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateTrafficPolicyVersion service method.</param> /// /// <returns>The response from the CreateTrafficPolicyVersion service method, as returned by Route53.</returns> /// <exception cref="Amazon.Route53.Model.ConcurrentModificationException"> /// Another user submitted a request to update the object at the same time that you did. /// Retry the request. /// </exception> /// <exception cref="Amazon.Route53.Model.InvalidInputException"> /// The input is not valid. /// </exception> /// <exception cref="Amazon.Route53.Model.InvalidTrafficPolicyDocumentException"> /// The format of the traffic policy document that you specified in the <code>Document</code> /// element is invalid. /// </exception> /// <exception cref="Amazon.Route53.Model.NoSuchTrafficPolicyException"> /// No traffic policy exists with the specified ID. /// </exception> public CreateTrafficPolicyVersionResponse CreateTrafficPolicyVersion(CreateTrafficPolicyVersionRequest request) { var marshaller = new CreateTrafficPolicyVersionRequestMarshaller(); var unmarshaller = CreateTrafficPolicyVersionResponseUnmarshaller.Instance; return Invoke<CreateTrafficPolicyVersionRequest,CreateTrafficPolicyVersionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateTrafficPolicyVersion operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTrafficPolicyVersion operation on AmazonRoute53Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateTrafficPolicyVersion /// operation.</returns> public IAsyncResult BeginCreateTrafficPolicyVersion(CreateTrafficPolicyVersionRequest request, AsyncCallback callback, object state) { var marshaller = new CreateTrafficPolicyVersionRequestMarshaller(); var unmarshaller = CreateTrafficPolicyVersionResponseUnmarshaller.Instance; return BeginInvoke<CreateTrafficPolicyVersionRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the CreateTrafficPolicyVersion operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTrafficPolicyVersion operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateTrafficPolicyVersionResponse> CreateTrafficPolicyVersionAsync(CreateTrafficPolicyVersionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateTrafficPolicyVersionRequestMarshaller(); var unmarshaller = CreateTrafficPolicyVersionResponseUnmarshaller.Instance; return InvokeAsync<CreateTrafficPolicyVersionRequest,CreateTrafficPolicyVersionResponse>(request, marshaller, unmarshaller, cancellationToken); }