private Amazon.EKS.Model.CreateClusterResponse CallAWSServiceOperation(IAmazonEKS client, Amazon.EKS.Model.CreateClusterRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Container Service for Kubernetes", "CreateCluster"); try { #if DESKTOP return(client.CreateCluster(request)); #elif CORECLR return(client.CreateClusterAsync(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.CreateClusterRequest(); if (cmdletContext.ClientRequestToken != null) { request.ClientRequestToken = cmdletContext.ClientRequestToken; } if (cmdletContext.EncryptionConfig != null) { request.EncryptionConfig = cmdletContext.EncryptionConfig; } // populate KubernetesNetworkConfig var requestKubernetesNetworkConfigIsNull = true; request.KubernetesNetworkConfig = new Amazon.EKS.Model.KubernetesNetworkConfigRequest(); System.String requestKubernetesNetworkConfig_kubernetesNetworkConfig_ServiceIpv4Cidr = null; if (cmdletContext.KubernetesNetworkConfig_ServiceIpv4Cidr != null) { requestKubernetesNetworkConfig_kubernetesNetworkConfig_ServiceIpv4Cidr = cmdletContext.KubernetesNetworkConfig_ServiceIpv4Cidr; } if (requestKubernetesNetworkConfig_kubernetesNetworkConfig_ServiceIpv4Cidr != null) { request.KubernetesNetworkConfig.ServiceIpv4Cidr = requestKubernetesNetworkConfig_kubernetesNetworkConfig_ServiceIpv4Cidr; requestKubernetesNetworkConfigIsNull = false; } // determine if request.KubernetesNetworkConfig should be set to null if (requestKubernetesNetworkConfigIsNull) { request.KubernetesNetworkConfig = null; } // populate Logging var requestLoggingIsNull = true; request.Logging = new Amazon.EKS.Model.Logging(); List <Amazon.EKS.Model.LogSetup> requestLogging_logging_ClusterLogging = null; if (cmdletContext.Logging_ClusterLogging != null) { requestLogging_logging_ClusterLogging = cmdletContext.Logging_ClusterLogging; } if (requestLogging_logging_ClusterLogging != null) { request.Logging.ClusterLogging = requestLogging_logging_ClusterLogging; requestLoggingIsNull = false; } // determine if request.Logging should be set to null if (requestLoggingIsNull) { request.Logging = null; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.ResourcesVpcConfig != null) { request.ResourcesVpcConfig = cmdletContext.ResourcesVpcConfig; } if (cmdletContext.RoleArn != null) { request.RoleArn = cmdletContext.RoleArn; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.Version != null) { request.Version = cmdletContext.Version; } 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); }