private Amazon.Amplify.Model.CreateAppResponse CallAWSServiceOperation(IAmazonAmplify client, Amazon.Amplify.Model.CreateAppRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Amplify", "CreateApp"); try { #if DESKTOP return(client.CreateApp(request)); #elif CORECLR return(client.CreateAppAsync(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.Amplify.Model.CreateAppRequest(); if (cmdletContext.AccessToken != null) { request.AccessToken = cmdletContext.AccessToken; } // 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; } System.String requestAutoBranchCreationConfig_autoBranchCreationConfig_PullRequestEnvironmentName = null; if (cmdletContext.AutoBranchCreationConfig_PullRequestEnvironmentName != null) { requestAutoBranchCreationConfig_autoBranchCreationConfig_PullRequestEnvironmentName = cmdletContext.AutoBranchCreationConfig_PullRequestEnvironmentName; } if (requestAutoBranchCreationConfig_autoBranchCreationConfig_PullRequestEnvironmentName != null) { request.AutoBranchCreationConfig.PullRequestEnvironmentName = requestAutoBranchCreationConfig_autoBranchCreationConfig_PullRequestEnvironmentName; 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; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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); }