private Amazon.AppMesh.Model.CreateVirtualNodeResponse CallAWSServiceOperation(IAmazonAppMesh client, Amazon.AppMesh.Model.CreateVirtualNodeRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS App Mesh", "CreateVirtualNode"); try { #if DESKTOP return(client.CreateVirtualNode(request)); #elif CORECLR return(client.CreateVirtualNodeAsync(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.AppMesh.Model.CreateVirtualNodeRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.MeshName != null) { request.MeshName = cmdletContext.MeshName; } // populate Spec var requestSpecIsNull = true; request.Spec = new Amazon.AppMesh.Model.VirtualNodeSpec(); List <Amazon.AppMesh.Model.Backend> requestSpec_spec_Backend = null; if (cmdletContext.Spec_Backend != null) { requestSpec_spec_Backend = cmdletContext.Spec_Backend; } if (requestSpec_spec_Backend != null) { request.Spec.Backends = requestSpec_spec_Backend; requestSpecIsNull = false; } List <Amazon.AppMesh.Model.Listener> requestSpec_spec_Listener = null; if (cmdletContext.Spec_Listener != null) { requestSpec_spec_Listener = cmdletContext.Spec_Listener; } if (requestSpec_spec_Listener != null) { request.Spec.Listeners = requestSpec_spec_Listener; requestSpecIsNull = false; } Amazon.AppMesh.Model.Logging requestSpec_spec_Logging = null; // populate Logging var requestSpec_spec_LoggingIsNull = true; requestSpec_spec_Logging = new Amazon.AppMesh.Model.Logging(); Amazon.AppMesh.Model.AccessLog requestSpec_spec_Logging_spec_Logging_AccessLog = null; // populate AccessLog var requestSpec_spec_Logging_spec_Logging_AccessLogIsNull = true; requestSpec_spec_Logging_spec_Logging_AccessLog = new Amazon.AppMesh.Model.AccessLog(); Amazon.AppMesh.Model.FileAccessLog requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File = null; // populate File var requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_FileIsNull = true; requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File = new Amazon.AppMesh.Model.FileAccessLog(); System.String requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File_file_Path = null; if (cmdletContext.File_Path != null) { requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File_file_Path = cmdletContext.File_Path; } if (requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File_file_Path != null) { requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File.Path = requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File_file_Path; requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_FileIsNull = false; } // determine if requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File should be set to null if (requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_FileIsNull) { requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File = null; } if (requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File != null) { requestSpec_spec_Logging_spec_Logging_AccessLog.File = requestSpec_spec_Logging_spec_Logging_AccessLog_spec_Logging_AccessLog_File; requestSpec_spec_Logging_spec_Logging_AccessLogIsNull = false; } // determine if requestSpec_spec_Logging_spec_Logging_AccessLog should be set to null if (requestSpec_spec_Logging_spec_Logging_AccessLogIsNull) { requestSpec_spec_Logging_spec_Logging_AccessLog = null; } if (requestSpec_spec_Logging_spec_Logging_AccessLog != null) { requestSpec_spec_Logging.AccessLog = requestSpec_spec_Logging_spec_Logging_AccessLog; requestSpec_spec_LoggingIsNull = false; } // determine if requestSpec_spec_Logging should be set to null if (requestSpec_spec_LoggingIsNull) { requestSpec_spec_Logging = null; } if (requestSpec_spec_Logging != null) { request.Spec.Logging = requestSpec_spec_Logging; requestSpecIsNull = false; } Amazon.AppMesh.Model.ServiceDiscovery requestSpec_spec_ServiceDiscovery = null; // populate ServiceDiscovery var requestSpec_spec_ServiceDiscoveryIsNull = true; requestSpec_spec_ServiceDiscovery = new Amazon.AppMesh.Model.ServiceDiscovery(); Amazon.AppMesh.Model.DnsServiceDiscovery requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns = null; // populate Dns var requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_DnsIsNull = true; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns = new Amazon.AppMesh.Model.DnsServiceDiscovery(); System.String requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns_dns_Hostname = null; if (cmdletContext.Dns_Hostname != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns_dns_Hostname = cmdletContext.Dns_Hostname; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns_dns_Hostname != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns.Hostname = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns_dns_Hostname; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_DnsIsNull = false; } // determine if requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns should be set to null if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_DnsIsNull) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns = null; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns != null) { requestSpec_spec_ServiceDiscovery.Dns = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_Dns; requestSpec_spec_ServiceDiscoveryIsNull = false; } Amazon.AppMesh.Model.AwsCloudMapServiceDiscovery requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap = null; // populate AwsCloudMap var requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMapIsNull = true; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap = new Amazon.AppMesh.Model.AwsCloudMapServiceDiscovery(); List <Amazon.AppMesh.Model.AwsCloudMapInstanceAttribute> requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_Attribute = null; if (cmdletContext.AwsCloudMap_Attribute != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_Attribute = cmdletContext.AwsCloudMap_Attribute; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_Attribute != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap.Attributes = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_Attribute; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMapIsNull = false; } System.String requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_NamespaceName = null; if (cmdletContext.AwsCloudMap_NamespaceName != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_NamespaceName = cmdletContext.AwsCloudMap_NamespaceName; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_NamespaceName != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap.NamespaceName = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_NamespaceName; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMapIsNull = false; } System.String requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_ServiceName = null; if (cmdletContext.AwsCloudMap_ServiceName != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_ServiceName = cmdletContext.AwsCloudMap_ServiceName; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_ServiceName != null) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap.ServiceName = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap_awsCloudMap_ServiceName; requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMapIsNull = false; } // determine if requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap should be set to null if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMapIsNull) { requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap = null; } if (requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap != null) { requestSpec_spec_ServiceDiscovery.AwsCloudMap = requestSpec_spec_ServiceDiscovery_spec_ServiceDiscovery_AwsCloudMap; requestSpec_spec_ServiceDiscoveryIsNull = false; } // determine if requestSpec_spec_ServiceDiscovery should be set to null if (requestSpec_spec_ServiceDiscoveryIsNull) { requestSpec_spec_ServiceDiscovery = null; } if (requestSpec_spec_ServiceDiscovery != null) { request.Spec.ServiceDiscovery = requestSpec_spec_ServiceDiscovery; requestSpecIsNull = false; } // determine if request.Spec should be set to null if (requestSpecIsNull) { request.Spec = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.VirtualNodeName != null) { request.VirtualNodeName = cmdletContext.VirtualNodeName; } 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); }