Esempio n. 1
0
 private Amazon.CloudFormation.Model.ActivateTypeResponse CallAWSServiceOperation(IAmazonCloudFormation client, Amazon.CloudFormation.Model.ActivateTypeRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudFormation", "ActivateType");
     try
     {
         #if DESKTOP
         return(client.ActivateType(request));
         #elif CORECLR
         return(client.ActivateTypeAsync(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.CloudFormation.Model.ActivateTypeRequest();

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

            // populate LoggingConfig
            var requestLoggingConfigIsNull = true;

            request.LoggingConfig = new Amazon.CloudFormation.Model.LoggingConfig();
            System.String requestLoggingConfig_loggingConfig_LogGroupName = null;
            if (cmdletContext.LoggingConfig_LogGroupName != null)
            {
                requestLoggingConfig_loggingConfig_LogGroupName = cmdletContext.LoggingConfig_LogGroupName;
            }
            if (requestLoggingConfig_loggingConfig_LogGroupName != null)
            {
                request.LoggingConfig.LogGroupName = requestLoggingConfig_loggingConfig_LogGroupName;
                requestLoggingConfigIsNull         = false;
            }
            System.String requestLoggingConfig_loggingConfig_LogRoleArn = null;
            if (cmdletContext.LoggingConfig_LogRoleArn != null)
            {
                requestLoggingConfig_loggingConfig_LogRoleArn = cmdletContext.LoggingConfig_LogRoleArn;
            }
            if (requestLoggingConfig_loggingConfig_LogRoleArn != null)
            {
                request.LoggingConfig.LogRoleArn = requestLoggingConfig_loggingConfig_LogRoleArn;
                requestLoggingConfigIsNull       = false;
            }
            // determine if request.LoggingConfig should be set to null
            if (requestLoggingConfigIsNull)
            {
                request.LoggingConfig = null;
            }
            if (cmdletContext.MajorVersion != null)
            {
                request.MajorVersion = cmdletContext.MajorVersion.Value;
            }
            if (cmdletContext.PublicTypeArn != null)
            {
                request.PublicTypeArn = cmdletContext.PublicTypeArn;
            }
            if (cmdletContext.PublisherId != null)
            {
                request.PublisherId = cmdletContext.PublisherId;
            }
            if (cmdletContext.Type != null)
            {
                request.Type = cmdletContext.Type;
            }
            if (cmdletContext.TypeName != null)
            {
                request.TypeName = cmdletContext.TypeName;
            }
            if (cmdletContext.TypeNameAlias != null)
            {
                request.TypeNameAlias = cmdletContext.TypeNameAlias;
            }
            if (cmdletContext.VersionBump != null)
            {
                request.VersionBump = cmdletContext.VersionBump;
            }

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