private Amazon.EKS.Model.RegisterClusterResponse CallAWSServiceOperation(IAmazonEKS client, Amazon.EKS.Model.RegisterClusterRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Container Service for Kubernetes", "RegisterCluster"); try { #if DESKTOP return(client.RegisterCluster(request)); #elif CORECLR return(client.RegisterClusterAsync(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.EKS.Model.RegisterClusterRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } // populate ConnectorConfig var requestConnectorConfigIsNull = true; request.ConnectorConfig = new Amazon.EKS.Model.ConnectorConfigRequest(); Amazon.EKS.ConnectorConfigProvider requestConnectorConfig_connectorConfig_Provider = null; if (cmdletContext.ConnectorConfig_Provider != null) { requestConnectorConfig_connectorConfig_Provider = cmdletContext.ConnectorConfig_Provider; } if (requestConnectorConfig_connectorConfig_Provider != null) { request.ConnectorConfig.Provider = requestConnectorConfig_connectorConfig_Provider; requestConnectorConfigIsNull = false; } System.String requestConnectorConfig_connectorConfig_RoleArn = null; if (cmdletContext.ConnectorConfig_RoleArn != null) { requestConnectorConfig_connectorConfig_RoleArn = cmdletContext.ConnectorConfig_RoleArn; } if (requestConnectorConfig_connectorConfig_RoleArn != null) { request.ConnectorConfig.RoleArn = requestConnectorConfig_connectorConfig_RoleArn; requestConnectorConfigIsNull = false; } // determine if request.ConnectorConfig should be set to null if (requestConnectorConfigIsNull) { request.ConnectorConfig = null; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }