Esempio n. 1
0
        public object Execute(ExecutorContext context)
        {
            System.IO.MemoryStream _ImageFileStream = null;

            try
            {
                var cmdletContext = context as CmdletContext;
                // create request
                var request = new Amazon.CognitoIdentityProvider.Model.SetUICustomizationRequest();

                if (cmdletContext.ClientId != null)
                {
                    request.ClientId = cmdletContext.ClientId;
                }
                if (cmdletContext.CSS != null)
                {
                    request.CSS = cmdletContext.CSS;
                }
                if (cmdletContext.ImageFile != null)
                {
                    _ImageFileStream  = new System.IO.MemoryStream(cmdletContext.ImageFile);
                    request.ImageFile = _ImageFileStream;
                }
                if (cmdletContext.UserPoolId != null)
                {
                    request.UserPoolId = cmdletContext.UserPoolId;
                }

                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);
            }
            finally
            {
                if (_ImageFileStream != null)
                {
                    _ImageFileStream.Dispose();
                }
            }
        }
Esempio n. 2
0
 private Amazon.CognitoIdentityProvider.Model.SetUICustomizationResponse CallAWSServiceOperation(IAmazonCognitoIdentityProvider client, Amazon.CognitoIdentityProvider.Model.SetUICustomizationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Identity Provider", "SetUICustomization");
     try
     {
         #if DESKTOP
         return(client.SetUICustomization(request));
         #elif CORECLR
         return(client.SetUICustomizationAsync(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;
     }
 }