Esempio n. 1
0
 private Amazon.ManagedBlockchain.Model.CreateNodeResponse CallAWSServiceOperation(IAmazonManagedBlockchain client, Amazon.ManagedBlockchain.Model.CreateNodeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Managed Blockchain", "CreateNode");
     try
     {
         #if DESKTOP
         return(client.CreateNode(request));
         #elif CORECLR
         return(client.CreateNodeAsync(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;
     }
 }
Esempio n. 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ManagedBlockchain.Model.CreateNodeRequest();

            if (cmdletContext.ClientRequestToken != null)
            {
                request.ClientRequestToken = cmdletContext.ClientRequestToken;
            }
            if (cmdletContext.MemberId != null)
            {
                request.MemberId = cmdletContext.MemberId;
            }
            if (cmdletContext.NetworkId != null)
            {
                request.NetworkId = cmdletContext.NetworkId;
            }

            // populate NodeConfiguration
            var requestNodeConfigurationIsNull = true;

            request.NodeConfiguration = new Amazon.ManagedBlockchain.Model.NodeConfiguration();
            System.String requestNodeConfiguration_nodeConfiguration_AvailabilityZone = null;
            if (cmdletContext.NodeConfiguration_AvailabilityZone != null)
            {
                requestNodeConfiguration_nodeConfiguration_AvailabilityZone = cmdletContext.NodeConfiguration_AvailabilityZone;
            }
            if (requestNodeConfiguration_nodeConfiguration_AvailabilityZone != null)
            {
                request.NodeConfiguration.AvailabilityZone = requestNodeConfiguration_nodeConfiguration_AvailabilityZone;
                requestNodeConfigurationIsNull             = false;
            }
            System.String requestNodeConfiguration_nodeConfiguration_InstanceType = null;
            if (cmdletContext.NodeConfiguration_InstanceType != null)
            {
                requestNodeConfiguration_nodeConfiguration_InstanceType = cmdletContext.NodeConfiguration_InstanceType;
            }
            if (requestNodeConfiguration_nodeConfiguration_InstanceType != null)
            {
                request.NodeConfiguration.InstanceType = requestNodeConfiguration_nodeConfiguration_InstanceType;
                requestNodeConfigurationIsNull         = false;
            }
            Amazon.ManagedBlockchain.StateDBType requestNodeConfiguration_nodeConfiguration_StateDB = null;
            if (cmdletContext.NodeConfiguration_StateDB != null)
            {
                requestNodeConfiguration_nodeConfiguration_StateDB = cmdletContext.NodeConfiguration_StateDB;
            }
            if (requestNodeConfiguration_nodeConfiguration_StateDB != null)
            {
                request.NodeConfiguration.StateDB = requestNodeConfiguration_nodeConfiguration_StateDB;
                requestNodeConfigurationIsNull    = false;
            }
            Amazon.ManagedBlockchain.Model.NodeLogPublishingConfiguration requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration = null;

            // populate LogPublishingConfiguration
            var requestNodeConfiguration_nodeConfiguration_LogPublishingConfigurationIsNull = true;

            requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration = new Amazon.ManagedBlockchain.Model.NodeLogPublishingConfiguration();
            Amazon.ManagedBlockchain.Model.NodeFabricLogPublishingConfiguration requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration_logPublishingConfiguration_Fabric = null;
            if (cmdletContext.LogPublishingConfiguration_Fabric != null)
            {
                requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration_logPublishingConfiguration_Fabric = cmdletContext.LogPublishingConfiguration_Fabric;
            }
            if (requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration_logPublishingConfiguration_Fabric != null)
            {
                requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration.Fabric = requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration_logPublishingConfiguration_Fabric;
                requestNodeConfiguration_nodeConfiguration_LogPublishingConfigurationIsNull  = false;
            }
            // determine if requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration should be set to null
            if (requestNodeConfiguration_nodeConfiguration_LogPublishingConfigurationIsNull)
            {
                requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration = null;
            }
            if (requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration != null)
            {
                request.NodeConfiguration.LogPublishingConfiguration = requestNodeConfiguration_nodeConfiguration_LogPublishingConfiguration;
                requestNodeConfigurationIsNull = false;
            }
            // determine if request.NodeConfiguration should be set to null
            if (requestNodeConfigurationIsNull)
            {
                request.NodeConfiguration = null;
            }
            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);
        }