private Amazon.KafkaConnect.Model.CreateCustomPluginResponse CallAWSServiceOperation(IAmazonKafkaConnect client, Amazon.KafkaConnect.Model.CreateCustomPluginRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Managed Streaming for Kafka Connect", "CreateCustomPlugin"); try { #if DESKTOP return(client.CreateCustomPlugin(request)); #elif CORECLR return(client.CreateCustomPluginAsync(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.KafkaConnect.Model.CreateCustomPluginRequest(); if (cmdletContext.ContentType != null) { request.ContentType = cmdletContext.ContentType; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } // populate Location var requestLocationIsNull = true; request.Location = new Amazon.KafkaConnect.Model.CustomPluginLocation(); Amazon.KafkaConnect.Model.S3Location requestLocation_location_S3Location = null; // populate S3Location var requestLocation_location_S3LocationIsNull = true; requestLocation_location_S3Location = new Amazon.KafkaConnect.Model.S3Location(); System.String requestLocation_location_S3Location_s3Location_BucketArn = null; if (cmdletContext.S3Location_BucketArn != null) { requestLocation_location_S3Location_s3Location_BucketArn = cmdletContext.S3Location_BucketArn; } if (requestLocation_location_S3Location_s3Location_BucketArn != null) { requestLocation_location_S3Location.BucketArn = requestLocation_location_S3Location_s3Location_BucketArn; requestLocation_location_S3LocationIsNull = false; } System.String requestLocation_location_S3Location_s3Location_FileKey = null; if (cmdletContext.S3Location_FileKey != null) { requestLocation_location_S3Location_s3Location_FileKey = cmdletContext.S3Location_FileKey; } if (requestLocation_location_S3Location_s3Location_FileKey != null) { requestLocation_location_S3Location.FileKey = requestLocation_location_S3Location_s3Location_FileKey; requestLocation_location_S3LocationIsNull = false; } System.String requestLocation_location_S3Location_s3Location_ObjectVersion = null; if (cmdletContext.S3Location_ObjectVersion != null) { requestLocation_location_S3Location_s3Location_ObjectVersion = cmdletContext.S3Location_ObjectVersion; } if (requestLocation_location_S3Location_s3Location_ObjectVersion != null) { requestLocation_location_S3Location.ObjectVersion = requestLocation_location_S3Location_s3Location_ObjectVersion; requestLocation_location_S3LocationIsNull = false; } // determine if requestLocation_location_S3Location should be set to null if (requestLocation_location_S3LocationIsNull) { requestLocation_location_S3Location = null; } if (requestLocation_location_S3Location != null) { request.Location.S3Location = requestLocation_location_S3Location; requestLocationIsNull = false; } // determine if request.Location should be set to null if (requestLocationIsNull) { request.Location = null; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } 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); }