private Amazon.Kafka.Model.UpdateConnectivityResponse CallAWSServiceOperation(IAmazonKafka client, Amazon.Kafka.Model.UpdateConnectivityRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Managed Streaming for Apache Kafka (MSK)", "UpdateConnectivity"); try { #if DESKTOP return(client.UpdateConnectivity(request)); #elif CORECLR return(client.UpdateConnectivityAsync(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.Kafka.Model.UpdateConnectivityRequest(); if (cmdletContext.ClusterArn != null) { request.ClusterArn = cmdletContext.ClusterArn; } // populate ConnectivityInfo var requestConnectivityInfoIsNull = true; request.ConnectivityInfo = new Amazon.Kafka.Model.ConnectivityInfo(); Amazon.Kafka.Model.PublicAccess requestConnectivityInfo_connectivityInfo_PublicAccess = null; // populate PublicAccess var requestConnectivityInfo_connectivityInfo_PublicAccessIsNull = true; requestConnectivityInfo_connectivityInfo_PublicAccess = new Amazon.Kafka.Model.PublicAccess(); System.String requestConnectivityInfo_connectivityInfo_PublicAccess_publicAccess_Type = null; if (cmdletContext.PublicAccess_Type != null) { requestConnectivityInfo_connectivityInfo_PublicAccess_publicAccess_Type = cmdletContext.PublicAccess_Type; } if (requestConnectivityInfo_connectivityInfo_PublicAccess_publicAccess_Type != null) { requestConnectivityInfo_connectivityInfo_PublicAccess.Type = requestConnectivityInfo_connectivityInfo_PublicAccess_publicAccess_Type; requestConnectivityInfo_connectivityInfo_PublicAccessIsNull = false; } // determine if requestConnectivityInfo_connectivityInfo_PublicAccess should be set to null if (requestConnectivityInfo_connectivityInfo_PublicAccessIsNull) { requestConnectivityInfo_connectivityInfo_PublicAccess = null; } if (requestConnectivityInfo_connectivityInfo_PublicAccess != null) { request.ConnectivityInfo.PublicAccess = requestConnectivityInfo_connectivityInfo_PublicAccess; requestConnectivityInfoIsNull = false; } // determine if request.ConnectivityInfo should be set to null if (requestConnectivityInfoIsNull) { request.ConnectivityInfo = null; } if (cmdletContext.CurrentVersion != null) { request.CurrentVersion = cmdletContext.CurrentVersion; } 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); }