private Amazon.Elasticsearch.Model.UpdatePackageResponse CallAWSServiceOperation(IAmazonElasticsearch client, Amazon.Elasticsearch.Model.UpdatePackageRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elasticsearch", "UpdatePackage"); try { #if DESKTOP return(client.UpdatePackage(request)); #elif CORECLR return(client.UpdatePackageAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Elasticsearch.Model.UpdatePackageRequest(); if (cmdletContext.CommitMessage != null) { request.CommitMessage = cmdletContext.CommitMessage; } if (cmdletContext.PackageDescription != null) { request.PackageDescription = cmdletContext.PackageDescription; } if (cmdletContext.PackageID != null) { request.PackageID = cmdletContext.PackageID; } // populate PackageSource var requestPackageSourceIsNull = true; request.PackageSource = new Amazon.Elasticsearch.Model.PackageSource(); System.String requestPackageSource_packageSource_S3BucketName = null; if (cmdletContext.PackageSource_S3BucketName != null) { requestPackageSource_packageSource_S3BucketName = cmdletContext.PackageSource_S3BucketName; } if (requestPackageSource_packageSource_S3BucketName != null) { request.PackageSource.S3BucketName = requestPackageSource_packageSource_S3BucketName; requestPackageSourceIsNull = false; } System.String requestPackageSource_packageSource_S3Key = null; if (cmdletContext.PackageSource_S3Key != null) { requestPackageSource_packageSource_S3Key = cmdletContext.PackageSource_S3Key; } if (requestPackageSource_packageSource_S3Key != null) { request.PackageSource.S3Key = requestPackageSource_packageSource_S3Key; requestPackageSourceIsNull = false; } // determine if request.PackageSource should be set to null if (requestPackageSourceIsNull) { request.PackageSource = null; } 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); }