Exemple #1
0
 private Amazon.Amplify.Model.UpdateAppResponse CallAWSServiceOperation(IAmazonAmplify client, Amazon.Amplify.Model.UpdateAppRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Amplify", "UpdateApp");
     try
     {
         #if DESKTOP
         return(client.UpdateApp(request));
         #elif CORECLR
         return(client.UpdateAppAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Amplify.Model.UpdateAppRequest();

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

            // populate AutoBranchCreationConfig
            var requestAutoBranchCreationConfigIsNull = true;

            request.AutoBranchCreationConfig = new Amazon.Amplify.Model.AutoBranchCreationConfig();
            System.String requestAutoBranchCreationConfig_autoBranchCreationConfig_BasicAuthCredential = null;
            if (cmdletContext.AutoBranchCreationConfig_BasicAuthCredential != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_BasicAuthCredential = cmdletContext.AutoBranchCreationConfig_BasicAuthCredential;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_BasicAuthCredential != null)
            {
                request.AutoBranchCreationConfig.BasicAuthCredentials = requestAutoBranchCreationConfig_autoBranchCreationConfig_BasicAuthCredential;
                requestAutoBranchCreationConfigIsNull = false;
            }
            System.String requestAutoBranchCreationConfig_autoBranchCreationConfig_BuildSpec = null;
            if (cmdletContext.AutoBranchCreationConfig_BuildSpec != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_BuildSpec = cmdletContext.AutoBranchCreationConfig_BuildSpec;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_BuildSpec != null)
            {
                request.AutoBranchCreationConfig.BuildSpec = requestAutoBranchCreationConfig_autoBranchCreationConfig_BuildSpec;
                requestAutoBranchCreationConfigIsNull      = false;
            }
            System.Boolean?requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableAutoBuild = null;
            if (cmdletContext.AutoBranchCreationConfig_EnableAutoBuild != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableAutoBuild = cmdletContext.AutoBranchCreationConfig_EnableAutoBuild.Value;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableAutoBuild != null)
            {
                request.AutoBranchCreationConfig.EnableAutoBuild = requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableAutoBuild.Value;
                requestAutoBranchCreationConfigIsNull            = false;
            }
            System.Boolean?requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableBasicAuth = null;
            if (cmdletContext.AutoBranchCreationConfig_EnableBasicAuth != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableBasicAuth = cmdletContext.AutoBranchCreationConfig_EnableBasicAuth.Value;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableBasicAuth != null)
            {
                request.AutoBranchCreationConfig.EnableBasicAuth = requestAutoBranchCreationConfig_autoBranchCreationConfig_EnableBasicAuth.Value;
                requestAutoBranchCreationConfigIsNull            = false;
            }
            System.Boolean?requestAutoBranchCreationConfig_autoBranchCreationConfig_EnablePullRequestPreview = null;
            if (cmdletContext.AutoBranchCreationConfig_EnablePullRequestPreview != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_EnablePullRequestPreview = cmdletContext.AutoBranchCreationConfig_EnablePullRequestPreview.Value;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_EnablePullRequestPreview != null)
            {
                request.AutoBranchCreationConfig.EnablePullRequestPreview = requestAutoBranchCreationConfig_autoBranchCreationConfig_EnablePullRequestPreview.Value;
                requestAutoBranchCreationConfigIsNull = false;
            }
            Dictionary <System.String, System.String> requestAutoBranchCreationConfig_autoBranchCreationConfig_EnvironmentVariable = null;

            if (cmdletContext.AutoBranchCreationConfig_EnvironmentVariable != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_EnvironmentVariable = cmdletContext.AutoBranchCreationConfig_EnvironmentVariable;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_EnvironmentVariable != null)
            {
                request.AutoBranchCreationConfig.EnvironmentVariables = requestAutoBranchCreationConfig_autoBranchCreationConfig_EnvironmentVariable;
                requestAutoBranchCreationConfigIsNull = false;
            }
            System.String requestAutoBranchCreationConfig_autoBranchCreationConfig_Framework = null;
            if (cmdletContext.AutoBranchCreationConfig_Framework != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_Framework = cmdletContext.AutoBranchCreationConfig_Framework;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_Framework != null)
            {
                request.AutoBranchCreationConfig.Framework = requestAutoBranchCreationConfig_autoBranchCreationConfig_Framework;
                requestAutoBranchCreationConfigIsNull      = false;
            }
            Amazon.Amplify.Stage requestAutoBranchCreationConfig_autoBranchCreationConfig_Stage = null;
            if (cmdletContext.AutoBranchCreationConfig_Stage != null)
            {
                requestAutoBranchCreationConfig_autoBranchCreationConfig_Stage = cmdletContext.AutoBranchCreationConfig_Stage;
            }
            if (requestAutoBranchCreationConfig_autoBranchCreationConfig_Stage != null)
            {
                request.AutoBranchCreationConfig.Stage = requestAutoBranchCreationConfig_autoBranchCreationConfig_Stage;
                requestAutoBranchCreationConfigIsNull  = false;
            }
            // determine if request.AutoBranchCreationConfig should be set to null
            if (requestAutoBranchCreationConfigIsNull)
            {
                request.AutoBranchCreationConfig = null;
            }
            if (cmdletContext.AutoBranchCreationPattern != null)
            {
                request.AutoBranchCreationPatterns = cmdletContext.AutoBranchCreationPattern;
            }
            if (cmdletContext.BasicAuthCredential != null)
            {
                request.BasicAuthCredentials = cmdletContext.BasicAuthCredential;
            }
            if (cmdletContext.BuildSpec != null)
            {
                request.BuildSpec = cmdletContext.BuildSpec;
            }
            if (cmdletContext.CustomRule != null)
            {
                request.CustomRules = cmdletContext.CustomRule;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.EnableAutoBranchCreation != null)
            {
                request.EnableAutoBranchCreation = cmdletContext.EnableAutoBranchCreation.Value;
            }
            if (cmdletContext.EnableBasicAuth != null)
            {
                request.EnableBasicAuth = cmdletContext.EnableBasicAuth.Value;
            }
            if (cmdletContext.EnableBranchAutoBuild != null)
            {
                request.EnableBranchAutoBuild = cmdletContext.EnableBranchAutoBuild.Value;
            }
            if (cmdletContext.EnvironmentVariable != null)
            {
                request.EnvironmentVariables = cmdletContext.EnvironmentVariable;
            }
            if (cmdletContext.IamServiceRoleArn != null)
            {
                request.IamServiceRoleArn = cmdletContext.IamServiceRoleArn;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.OauthToken != null)
            {
                request.OauthToken = cmdletContext.OauthToken;
            }
            if (cmdletContext.Platform != null)
            {
                request.Platform = cmdletContext.Platform;
            }
            if (cmdletContext.Repository != null)
            {
                request.Repository = cmdletContext.Repository;
            }

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