コード例 #1
0
 private Amazon.AmplifyUIBuilder.Model.CreateComponentResponse CallAWSServiceOperation(IAmazonAmplifyUIBuilder client, Amazon.AmplifyUIBuilder.Model.CreateComponentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Amplify UI Builder", "CreateComponent");
     try
     {
         #if DESKTOP
         return(client.CreateComponent(request));
         #elif CORECLR
         return(client.CreateComponentAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AmplifyUIBuilder.Model.CreateComponentRequest();

            if (cmdletContext.AppId != null)
            {
                request.AppId = cmdletContext.AppId;
            }
            if (cmdletContext.ClientToken != null)
            {
                request.ClientToken = cmdletContext.ClientToken;
            }

            // populate ComponentToCreate
            var requestComponentToCreateIsNull = true;

            request.ComponentToCreate = new Amazon.AmplifyUIBuilder.Model.CreateComponentData();
            Dictionary <System.String, Amazon.AmplifyUIBuilder.Model.ComponentBindingPropertiesValue> requestComponentToCreate_componentToCreate_BindingProperty = null;

            if (cmdletContext.ComponentToCreate_BindingProperty != null)
            {
                requestComponentToCreate_componentToCreate_BindingProperty = cmdletContext.ComponentToCreate_BindingProperty;
            }
            if (requestComponentToCreate_componentToCreate_BindingProperty != null)
            {
                request.ComponentToCreate.BindingProperties = requestComponentToCreate_componentToCreate_BindingProperty;
                requestComponentToCreateIsNull = false;
            }
            List <Amazon.AmplifyUIBuilder.Model.ComponentChild> requestComponentToCreate_componentToCreate_Child = null;

            if (cmdletContext.ComponentToCreate_Child != null)
            {
                requestComponentToCreate_componentToCreate_Child = cmdletContext.ComponentToCreate_Child;
            }
            if (requestComponentToCreate_componentToCreate_Child != null)
            {
                request.ComponentToCreate.Children = requestComponentToCreate_componentToCreate_Child;
                requestComponentToCreateIsNull     = false;
            }
            Dictionary <System.String, Amazon.AmplifyUIBuilder.Model.ComponentDataConfiguration> requestComponentToCreate_componentToCreate_CollectionProperty = null;

            if (cmdletContext.ComponentToCreate_CollectionProperty != null)
            {
                requestComponentToCreate_componentToCreate_CollectionProperty = cmdletContext.ComponentToCreate_CollectionProperty;
            }
            if (requestComponentToCreate_componentToCreate_CollectionProperty != null)
            {
                request.ComponentToCreate.CollectionProperties = requestComponentToCreate_componentToCreate_CollectionProperty;
                requestComponentToCreateIsNull = false;
            }
            System.String requestComponentToCreate_componentToCreate_ComponentType = null;
            if (cmdletContext.ComponentToCreate_ComponentType != null)
            {
                requestComponentToCreate_componentToCreate_ComponentType = cmdletContext.ComponentToCreate_ComponentType;
            }
            if (requestComponentToCreate_componentToCreate_ComponentType != null)
            {
                request.ComponentToCreate.ComponentType = requestComponentToCreate_componentToCreate_ComponentType;
                requestComponentToCreateIsNull          = false;
            }
            System.String requestComponentToCreate_componentToCreate_Name = null;
            if (cmdletContext.ComponentToCreate_Name != null)
            {
                requestComponentToCreate_componentToCreate_Name = cmdletContext.ComponentToCreate_Name;
            }
            if (requestComponentToCreate_componentToCreate_Name != null)
            {
                request.ComponentToCreate.Name = requestComponentToCreate_componentToCreate_Name;
                requestComponentToCreateIsNull = false;
            }
            Dictionary <System.String, Dictionary <System.String, System.String> > requestComponentToCreate_componentToCreate_Override = null;

            if (cmdletContext.ComponentToCreate_Override != null)
            {
                requestComponentToCreate_componentToCreate_Override = cmdletContext.ComponentToCreate_Override;
            }
            if (requestComponentToCreate_componentToCreate_Override != null)
            {
                request.ComponentToCreate.Overrides = requestComponentToCreate_componentToCreate_Override;
                requestComponentToCreateIsNull      = false;
            }
            Dictionary <System.String, Amazon.AmplifyUIBuilder.Model.ComponentProperty> requestComponentToCreate_componentToCreate_Property = null;

            if (cmdletContext.ComponentToCreate_Property != null)
            {
                requestComponentToCreate_componentToCreate_Property = cmdletContext.ComponentToCreate_Property;
            }
            if (requestComponentToCreate_componentToCreate_Property != null)
            {
                request.ComponentToCreate.Properties = requestComponentToCreate_componentToCreate_Property;
                requestComponentToCreateIsNull       = false;
            }
            System.String requestComponentToCreate_componentToCreate_SourceId = null;
            if (cmdletContext.ComponentToCreate_SourceId != null)
            {
                requestComponentToCreate_componentToCreate_SourceId = cmdletContext.ComponentToCreate_SourceId;
            }
            if (requestComponentToCreate_componentToCreate_SourceId != null)
            {
                request.ComponentToCreate.SourceId = requestComponentToCreate_componentToCreate_SourceId;
                requestComponentToCreateIsNull     = false;
            }
            Dictionary <System.String, System.String> requestComponentToCreate_componentToCreate_Tag = null;

            if (cmdletContext.ComponentToCreate_Tag != null)
            {
                requestComponentToCreate_componentToCreate_Tag = cmdletContext.ComponentToCreate_Tag;
            }
            if (requestComponentToCreate_componentToCreate_Tag != null)
            {
                request.ComponentToCreate.Tags = requestComponentToCreate_componentToCreate_Tag;
                requestComponentToCreateIsNull = false;
            }
            List <Amazon.AmplifyUIBuilder.Model.ComponentVariant> requestComponentToCreate_componentToCreate_Variant = null;

            if (cmdletContext.ComponentToCreate_Variant != null)
            {
                requestComponentToCreate_componentToCreate_Variant = cmdletContext.ComponentToCreate_Variant;
            }
            if (requestComponentToCreate_componentToCreate_Variant != null)
            {
                request.ComponentToCreate.Variants = requestComponentToCreate_componentToCreate_Variant;
                requestComponentToCreateIsNull     = false;
            }
            // determine if request.ComponentToCreate should be set to null
            if (requestComponentToCreateIsNull)
            {
                request.ComponentToCreate = null;
            }
            if (cmdletContext.EnvironmentName != null)
            {
                request.EnvironmentName = cmdletContext.EnvironmentName;
            }

            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);
        }