private Amazon.Amplify.Model.CreateBranchResponse CallAWSServiceOperation(IAmazonAmplify client, Amazon.Amplify.Model.CreateBranchRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Amplify", "CreateBranch"); try { #if DESKTOP return(client.CreateBranch(request)); #elif CORECLR return(client.CreateBranchAsync(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.CreateBranchRequest(); if (cmdletContext.AppId != null) { request.AppId = cmdletContext.AppId; } if (cmdletContext.BackendEnvironmentArn != null) { request.BackendEnvironmentArn = cmdletContext.BackendEnvironmentArn; } if (cmdletContext.BasicAuthCredential != null) { request.BasicAuthCredentials = cmdletContext.BasicAuthCredential; } if (cmdletContext.BranchName != null) { request.BranchName = cmdletContext.BranchName; } if (cmdletContext.BuildSpec != null) { request.BuildSpec = cmdletContext.BuildSpec; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DisplayName != null) { request.DisplayName = cmdletContext.DisplayName; } if (cmdletContext.EnableAutoBuild != null) { request.EnableAutoBuild = cmdletContext.EnableAutoBuild.Value; } if (cmdletContext.EnableBasicAuth != null) { request.EnableBasicAuth = cmdletContext.EnableBasicAuth.Value; } if (cmdletContext.EnableNotification != null) { request.EnableNotification = cmdletContext.EnableNotification.Value; } if (cmdletContext.EnablePerformanceMode != null) { request.EnablePerformanceMode = cmdletContext.EnablePerformanceMode.Value; } if (cmdletContext.EnablePullRequestPreview != null) { request.EnablePullRequestPreview = cmdletContext.EnablePullRequestPreview.Value; } if (cmdletContext.EnvironmentVariable != null) { request.EnvironmentVariables = cmdletContext.EnvironmentVariable; } if (cmdletContext.Framework != null) { request.Framework = cmdletContext.Framework; } if (cmdletContext.PullRequestEnvironmentName != null) { request.PullRequestEnvironmentName = cmdletContext.PullRequestEnvironmentName; } if (cmdletContext.Stage != null) { request.Stage = cmdletContext.Stage; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.Ttl != null) { request.Ttl = cmdletContext.Ttl; } 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); }