private Amazon.ConfigService.Model.PutOrganizationConfigRuleResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.PutOrganizationConfigRuleRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "PutOrganizationConfigRule");
     try
     {
         #if DESKTOP
         return(client.PutOrganizationConfigRule(request));
         #elif CORECLR
         return(client.PutOrganizationConfigRuleAsync(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.ConfigService.Model.PutOrganizationConfigRuleRequest();

            if (cmdletContext.ExcludedAccount != null)
            {
                request.ExcludedAccounts = cmdletContext.ExcludedAccount;
            }
            if (cmdletContext.OrganizationConfigRuleName != null)
            {
                request.OrganizationConfigRuleName = cmdletContext.OrganizationConfigRuleName;
            }

            // populate OrganizationCustomRuleMetadata
            var requestOrganizationCustomRuleMetadataIsNull = true;

            request.OrganizationCustomRuleMetadata = new Amazon.ConfigService.Model.OrganizationCustomRuleMetadata();
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_Description = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_Description != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_Description = cmdletContext.OrganizationCustomRuleMetadata_Description;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_Description != null)
            {
                request.OrganizationCustomRuleMetadata.Description = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_Description;
                requestOrganizationCustomRuleMetadataIsNull        = false;
            }
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_InputParameter = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_InputParameter != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_InputParameter = cmdletContext.OrganizationCustomRuleMetadata_InputParameter;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_InputParameter != null)
            {
                request.OrganizationCustomRuleMetadata.InputParameters = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_InputParameter;
                requestOrganizationCustomRuleMetadataIsNull            = false;
            }
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_LambdaFunctionArn = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_LambdaFunctionArn != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_LambdaFunctionArn = cmdletContext.OrganizationCustomRuleMetadata_LambdaFunctionArn;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_LambdaFunctionArn != null)
            {
                request.OrganizationCustomRuleMetadata.LambdaFunctionArn = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_LambdaFunctionArn;
                requestOrganizationCustomRuleMetadataIsNull = false;
            }
            Amazon.ConfigService.MaximumExecutionFrequency requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_MaximumExecutionFrequency = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_MaximumExecutionFrequency != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_MaximumExecutionFrequency = cmdletContext.OrganizationCustomRuleMetadata_MaximumExecutionFrequency;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_MaximumExecutionFrequency != null)
            {
                request.OrganizationCustomRuleMetadata.MaximumExecutionFrequency = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_MaximumExecutionFrequency;
                requestOrganizationCustomRuleMetadataIsNull = false;
            }
            List <System.String> requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_OrganizationConfigRuleTriggerType = null;

            if (cmdletContext.OrganizationCustomRuleMetadata_OrganizationConfigRuleTriggerType != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_OrganizationConfigRuleTriggerType = cmdletContext.OrganizationCustomRuleMetadata_OrganizationConfigRuleTriggerType;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_OrganizationConfigRuleTriggerType != null)
            {
                request.OrganizationCustomRuleMetadata.OrganizationConfigRuleTriggerTypes = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_OrganizationConfigRuleTriggerType;
                requestOrganizationCustomRuleMetadataIsNull = false;
            }
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceIdScope = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_ResourceIdScope != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceIdScope = cmdletContext.OrganizationCustomRuleMetadata_ResourceIdScope;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceIdScope != null)
            {
                request.OrganizationCustomRuleMetadata.ResourceIdScope = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceIdScope;
                requestOrganizationCustomRuleMetadataIsNull            = false;
            }
            List <System.String> requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceTypesScope = null;

            if (cmdletContext.OrganizationCustomRuleMetadata_ResourceTypesScope != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceTypesScope = cmdletContext.OrganizationCustomRuleMetadata_ResourceTypesScope;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceTypesScope != null)
            {
                request.OrganizationCustomRuleMetadata.ResourceTypesScope = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_ResourceTypesScope;
                requestOrganizationCustomRuleMetadataIsNull = false;
            }
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagKeyScope = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_TagKeyScope != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagKeyScope = cmdletContext.OrganizationCustomRuleMetadata_TagKeyScope;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagKeyScope != null)
            {
                request.OrganizationCustomRuleMetadata.TagKeyScope = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagKeyScope;
                requestOrganizationCustomRuleMetadataIsNull        = false;
            }
            System.String requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagValueScope = null;
            if (cmdletContext.OrganizationCustomRuleMetadata_TagValueScope != null)
            {
                requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagValueScope = cmdletContext.OrganizationCustomRuleMetadata_TagValueScope;
            }
            if (requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagValueScope != null)
            {
                request.OrganizationCustomRuleMetadata.TagValueScope = requestOrganizationCustomRuleMetadata_organizationCustomRuleMetadata_TagValueScope;
                requestOrganizationCustomRuleMetadataIsNull          = false;
            }
            // determine if request.OrganizationCustomRuleMetadata should be set to null
            if (requestOrganizationCustomRuleMetadataIsNull)
            {
                request.OrganizationCustomRuleMetadata = null;
            }

            // populate OrganizationManagedRuleMetadata
            var requestOrganizationManagedRuleMetadataIsNull = true;

            request.OrganizationManagedRuleMetadata = new Amazon.ConfigService.Model.OrganizationManagedRuleMetadata();
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_Description = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_Description != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_Description = cmdletContext.OrganizationManagedRuleMetadata_Description;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_Description != null)
            {
                request.OrganizationManagedRuleMetadata.Description = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_Description;
                requestOrganizationManagedRuleMetadataIsNull        = false;
            }
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_InputParameter = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_InputParameter != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_InputParameter = cmdletContext.OrganizationManagedRuleMetadata_InputParameter;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_InputParameter != null)
            {
                request.OrganizationManagedRuleMetadata.InputParameters = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_InputParameter;
                requestOrganizationManagedRuleMetadataIsNull            = false;
            }
            Amazon.ConfigService.MaximumExecutionFrequency requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_MaximumExecutionFrequency = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_MaximumExecutionFrequency != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_MaximumExecutionFrequency = cmdletContext.OrganizationManagedRuleMetadata_MaximumExecutionFrequency;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_MaximumExecutionFrequency != null)
            {
                request.OrganizationManagedRuleMetadata.MaximumExecutionFrequency = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_MaximumExecutionFrequency;
                requestOrganizationManagedRuleMetadataIsNull = false;
            }
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceIdScope = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_ResourceIdScope != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceIdScope = cmdletContext.OrganizationManagedRuleMetadata_ResourceIdScope;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceIdScope != null)
            {
                request.OrganizationManagedRuleMetadata.ResourceIdScope = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceIdScope;
                requestOrganizationManagedRuleMetadataIsNull            = false;
            }
            List <System.String> requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceTypesScope = null;

            if (cmdletContext.OrganizationManagedRuleMetadata_ResourceTypesScope != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceTypesScope = cmdletContext.OrganizationManagedRuleMetadata_ResourceTypesScope;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceTypesScope != null)
            {
                request.OrganizationManagedRuleMetadata.ResourceTypesScope = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_ResourceTypesScope;
                requestOrganizationManagedRuleMetadataIsNull = false;
            }
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_RuleIdentifier = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_RuleIdentifier != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_RuleIdentifier = cmdletContext.OrganizationManagedRuleMetadata_RuleIdentifier;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_RuleIdentifier != null)
            {
                request.OrganizationManagedRuleMetadata.RuleIdentifier = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_RuleIdentifier;
                requestOrganizationManagedRuleMetadataIsNull           = false;
            }
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagKeyScope = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_TagKeyScope != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagKeyScope = cmdletContext.OrganizationManagedRuleMetadata_TagKeyScope;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagKeyScope != null)
            {
                request.OrganizationManagedRuleMetadata.TagKeyScope = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagKeyScope;
                requestOrganizationManagedRuleMetadataIsNull        = false;
            }
            System.String requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagValueScope = null;
            if (cmdletContext.OrganizationManagedRuleMetadata_TagValueScope != null)
            {
                requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagValueScope = cmdletContext.OrganizationManagedRuleMetadata_TagValueScope;
            }
            if (requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagValueScope != null)
            {
                request.OrganizationManagedRuleMetadata.TagValueScope = requestOrganizationManagedRuleMetadata_organizationManagedRuleMetadata_TagValueScope;
                requestOrganizationManagedRuleMetadataIsNull          = false;
            }
            // determine if request.OrganizationManagedRuleMetadata should be set to null
            if (requestOrganizationManagedRuleMetadataIsNull)
            {
                request.OrganizationManagedRuleMetadata = 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);
        }