public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoTThingsGraph.Model.CreateSystemInstanceRequest();


            // populate Definition
            var requestDefinitionIsNull = true;

            request.Definition = new Amazon.IoTThingsGraph.Model.DefinitionDocument();
            Amazon.IoTThingsGraph.DefinitionLanguage requestDefinition_definition_Language = null;
            if (cmdletContext.Definition_Language != null)
            {
                requestDefinition_definition_Language = cmdletContext.Definition_Language;
            }
            if (requestDefinition_definition_Language != null)
            {
                request.Definition.Language = requestDefinition_definition_Language;
                requestDefinitionIsNull     = false;
            }
            System.String requestDefinition_definition_Text = null;
            if (cmdletContext.Definition_Text != null)
            {
                requestDefinition_definition_Text = cmdletContext.Definition_Text;
            }
            if (requestDefinition_definition_Text != null)
            {
                request.Definition.Text = requestDefinition_definition_Text;
                requestDefinitionIsNull = false;
            }
            // determine if request.Definition should be set to null
            if (requestDefinitionIsNull)
            {
                request.Definition = null;
            }
            if (cmdletContext.FlowActionsRoleArn != null)
            {
                request.FlowActionsRoleArn = cmdletContext.FlowActionsRoleArn;
            }
            if (cmdletContext.GreengrassGroupName != null)
            {
                request.GreengrassGroupName = cmdletContext.GreengrassGroupName;
            }

            // populate MetricsConfiguration
            var requestMetricsConfigurationIsNull = true;

            request.MetricsConfiguration = new Amazon.IoTThingsGraph.Model.MetricsConfiguration();
            System.Boolean?requestMetricsConfiguration_metricsConfiguration_CloudMetricEnabled = null;
            if (cmdletContext.MetricsConfiguration_CloudMetricEnabled != null)
            {
                requestMetricsConfiguration_metricsConfiguration_CloudMetricEnabled = cmdletContext.MetricsConfiguration_CloudMetricEnabled.Value;
            }
            if (requestMetricsConfiguration_metricsConfiguration_CloudMetricEnabled != null)
            {
                request.MetricsConfiguration.CloudMetricEnabled = requestMetricsConfiguration_metricsConfiguration_CloudMetricEnabled.Value;
                requestMetricsConfigurationIsNull = false;
            }
            System.String requestMetricsConfiguration_metricsConfiguration_MetricRuleRoleArn = null;
            if (cmdletContext.MetricsConfiguration_MetricRuleRoleArn != null)
            {
                requestMetricsConfiguration_metricsConfiguration_MetricRuleRoleArn = cmdletContext.MetricsConfiguration_MetricRuleRoleArn;
            }
            if (requestMetricsConfiguration_metricsConfiguration_MetricRuleRoleArn != null)
            {
                request.MetricsConfiguration.MetricRuleRoleArn = requestMetricsConfiguration_metricsConfiguration_MetricRuleRoleArn;
                requestMetricsConfigurationIsNull = false;
            }
            // determine if request.MetricsConfiguration should be set to null
            if (requestMetricsConfigurationIsNull)
            {
                request.MetricsConfiguration = null;
            }
            if (cmdletContext.S3BucketName != null)
            {
                request.S3BucketName = cmdletContext.S3BucketName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }
            if (cmdletContext.Target != null)
            {
                request.Target = cmdletContext.Target;
            }

            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);
        }
예제 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoTThingsGraph.Model.CreateFlowTemplateRequest();

            if (cmdletContext.CompatibleNamespaceVersion != null)
            {
                request.CompatibleNamespaceVersion = cmdletContext.CompatibleNamespaceVersion.Value;
            }

            // populate Definition
            var requestDefinitionIsNull = true;

            request.Definition = new Amazon.IoTThingsGraph.Model.DefinitionDocument();
            Amazon.IoTThingsGraph.DefinitionLanguage requestDefinition_definition_Language = null;
            if (cmdletContext.Definition_Language != null)
            {
                requestDefinition_definition_Language = cmdletContext.Definition_Language;
            }
            if (requestDefinition_definition_Language != null)
            {
                request.Definition.Language = requestDefinition_definition_Language;
                requestDefinitionIsNull     = false;
            }
            System.String requestDefinition_definition_Text = null;
            if (cmdletContext.Definition_Text != null)
            {
                requestDefinition_definition_Text = cmdletContext.Definition_Text;
            }
            if (requestDefinition_definition_Text != null)
            {
                request.Definition.Text = requestDefinition_definition_Text;
                requestDefinitionIsNull = false;
            }
            // determine if request.Definition should be set to null
            if (requestDefinitionIsNull)
            {
                request.Definition = null;
            }

            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);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoTThingsGraph.Model.UploadEntityDefinitionsRequest();

            if (cmdletContext.DeprecateExistingEntity != null)
            {
                request.DeprecateExistingEntities = cmdletContext.DeprecateExistingEntity.Value;
            }

            // populate Document
            var requestDocumentIsNull = true;

            request.Document = new Amazon.IoTThingsGraph.Model.DefinitionDocument();
            Amazon.IoTThingsGraph.DefinitionLanguage requestDocument_document_Language = null;
            if (cmdletContext.Document_Language != null)
            {
                requestDocument_document_Language = cmdletContext.Document_Language;
            }
            if (requestDocument_document_Language != null)
            {
                request.Document.Language = requestDocument_document_Language;
                requestDocumentIsNull     = false;
            }
            System.String requestDocument_document_Text = null;
            if (cmdletContext.Document_Text != null)
            {
                requestDocument_document_Text = cmdletContext.Document_Text;
            }
            if (requestDocument_document_Text != null)
            {
                request.Document.Text = requestDocument_document_Text;
                requestDocumentIsNull = false;
            }
            // determine if request.Document should be set to null
            if (requestDocumentIsNull)
            {
                request.Document = null;
            }
            if (cmdletContext.SyncWithPublicNamespace != null)
            {
                request.SyncWithPublicNamespace = cmdletContext.SyncWithPublicNamespace.Value;
            }

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