Exemplo n.º 1
0
 private Amazon.AmplifyBackend.Model.UpdateBackendConfigResponse CallAWSServiceOperation(IAmazonAmplifyBackend client, Amazon.AmplifyBackend.Model.UpdateBackendConfigRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amplify Backend", "UpdateBackendConfig");
     try
     {
         #if DESKTOP
         return(client.UpdateBackendConfig(request));
         #elif CORECLR
         return(client.UpdateBackendConfigAsync(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;
     }
 }
Exemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AmplifyBackend.Model.UpdateBackendConfigRequest();

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

            // populate LoginAuthConfig
            var requestLoginAuthConfigIsNull = true;

            request.LoginAuthConfig = new Amazon.AmplifyBackend.Model.LoginAuthConfigReqObj();
            System.String requestLoginAuthConfig_loginAuthConfig_AwsCognitoIdentityPoolId = null;
            if (cmdletContext.LoginAuthConfig_AwsCognitoIdentityPoolId != null)
            {
                requestLoginAuthConfig_loginAuthConfig_AwsCognitoIdentityPoolId = cmdletContext.LoginAuthConfig_AwsCognitoIdentityPoolId;
            }
            if (requestLoginAuthConfig_loginAuthConfig_AwsCognitoIdentityPoolId != null)
            {
                request.LoginAuthConfig.AwsCognitoIdentityPoolId = requestLoginAuthConfig_loginAuthConfig_AwsCognitoIdentityPoolId;
                requestLoginAuthConfigIsNull = false;
            }
            System.String requestLoginAuthConfig_loginAuthConfig_AwsCognitoRegion = null;
            if (cmdletContext.LoginAuthConfig_AwsCognitoRegion != null)
            {
                requestLoginAuthConfig_loginAuthConfig_AwsCognitoRegion = cmdletContext.LoginAuthConfig_AwsCognitoRegion;
            }
            if (requestLoginAuthConfig_loginAuthConfig_AwsCognitoRegion != null)
            {
                request.LoginAuthConfig.AwsCognitoRegion = requestLoginAuthConfig_loginAuthConfig_AwsCognitoRegion;
                requestLoginAuthConfigIsNull             = false;
            }
            System.String requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsId = null;
            if (cmdletContext.LoginAuthConfig_AwsUserPoolsId != null)
            {
                requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsId = cmdletContext.LoginAuthConfig_AwsUserPoolsId;
            }
            if (requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsId != null)
            {
                request.LoginAuthConfig.AwsUserPoolsId = requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsId;
                requestLoginAuthConfigIsNull           = false;
            }
            System.String requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsWebClientId = null;
            if (cmdletContext.LoginAuthConfig_AwsUserPoolsWebClientId != null)
            {
                requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsWebClientId = cmdletContext.LoginAuthConfig_AwsUserPoolsWebClientId;
            }
            if (requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsWebClientId != null)
            {
                request.LoginAuthConfig.AwsUserPoolsWebClientId = requestLoginAuthConfig_loginAuthConfig_AwsUserPoolsWebClientId;
                requestLoginAuthConfigIsNull = false;
            }
            // determine if request.LoginAuthConfig should be set to null
            if (requestLoginAuthConfigIsNull)
            {
                request.LoginAuthConfig = 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);
        }