private Amazon.EMRContainers.Model.CreateVirtualClusterResponse CallAWSServiceOperation(IAmazonEMRContainers client, Amazon.EMRContainers.Model.CreateVirtualClusterRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EMR Containers", "CreateVirtualCluster"); try { #if DESKTOP return(client.CreateVirtualCluster(request)); #elif CORECLR return(client.CreateVirtualClusterAsync(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.EMRContainers.Model.CreateVirtualClusterRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } // populate ContainerProvider var requestContainerProviderIsNull = true; request.ContainerProvider = new Amazon.EMRContainers.Model.ContainerProvider(); System.String requestContainerProvider_containerProvider_Id = null; if (cmdletContext.ContainerProvider_Id != null) { requestContainerProvider_containerProvider_Id = cmdletContext.ContainerProvider_Id; } if (requestContainerProvider_containerProvider_Id != null) { request.ContainerProvider.Id = requestContainerProvider_containerProvider_Id; requestContainerProviderIsNull = false; } Amazon.EMRContainers.ContainerProviderType requestContainerProvider_containerProvider_Type = null; if (cmdletContext.ContainerProvider_Type != null) { requestContainerProvider_containerProvider_Type = cmdletContext.ContainerProvider_Type; } if (requestContainerProvider_containerProvider_Type != null) { request.ContainerProvider.Type = requestContainerProvider_containerProvider_Type; requestContainerProviderIsNull = false; } Amazon.EMRContainers.Model.ContainerInfo requestContainerProvider_containerProvider_Info = null; // populate Info var requestContainerProvider_containerProvider_InfoIsNull = true; requestContainerProvider_containerProvider_Info = new Amazon.EMRContainers.Model.ContainerInfo(); Amazon.EMRContainers.Model.EksInfo requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo = null; // populate EksInfo var requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfoIsNull = true; requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo = new Amazon.EMRContainers.Model.EksInfo(); System.String requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo_eksInfo_Namespace = null; if (cmdletContext.EksInfo_Namespace != null) { requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo_eksInfo_Namespace = cmdletContext.EksInfo_Namespace; } if (requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo_eksInfo_Namespace != null) { requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo.Namespace = requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo_eksInfo_Namespace; requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfoIsNull = false; } // determine if requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo should be set to null if (requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfoIsNull) { requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo = null; } if (requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo != null) { requestContainerProvider_containerProvider_Info.EksInfo = requestContainerProvider_containerProvider_Info_containerProvider_Info_EksInfo; requestContainerProvider_containerProvider_InfoIsNull = false; } // determine if requestContainerProvider_containerProvider_Info should be set to null if (requestContainerProvider_containerProvider_InfoIsNull) { requestContainerProvider_containerProvider_Info = null; } if (requestContainerProvider_containerProvider_Info != null) { request.ContainerProvider.Info = requestContainerProvider_containerProvider_Info; requestContainerProviderIsNull = false; } // determine if request.ContainerProvider should be set to null if (requestContainerProviderIsNull) { request.ContainerProvider = 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); }