private Amazon.AmplifyBackend.Model.CreateBackendAPIResponse CallAWSServiceOperation(IAmazonAmplifyBackend client, Amazon.AmplifyBackend.Model.CreateBackendAPIRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amplify Backend", "CreateBackendAPI"); try { #if DESKTOP return(client.CreateBackendAPI(request)); #elif CORECLR return(client.CreateBackendAPIAsync(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.AmplifyBackend.Model.CreateBackendAPIRequest(); if (cmdletContext.AppId != null) { request.AppId = cmdletContext.AppId; } if (cmdletContext.BackendEnvironmentName != null) { request.BackendEnvironmentName = cmdletContext.BackendEnvironmentName; } // populate ResourceConfig var requestResourceConfigIsNull = true; request.ResourceConfig = new Amazon.AmplifyBackend.Model.BackendAPIResourceConfig(); List <Amazon.AmplifyBackend.Model.BackendAPIAuthType> requestResourceConfig_resourceConfig_AdditionalAuthType = null; if (cmdletContext.ResourceConfig_AdditionalAuthType != null) { requestResourceConfig_resourceConfig_AdditionalAuthType = cmdletContext.ResourceConfig_AdditionalAuthType; } if (requestResourceConfig_resourceConfig_AdditionalAuthType != null) { request.ResourceConfig.AdditionalAuthTypes = requestResourceConfig_resourceConfig_AdditionalAuthType; requestResourceConfigIsNull = false; } System.String requestResourceConfig_resourceConfig_ApiName = null; if (cmdletContext.ResourceConfig_ApiName != null) { requestResourceConfig_resourceConfig_ApiName = cmdletContext.ResourceConfig_ApiName; } if (requestResourceConfig_resourceConfig_ApiName != null) { request.ResourceConfig.ApiName = requestResourceConfig_resourceConfig_ApiName; requestResourceConfigIsNull = false; } System.String requestResourceConfig_resourceConfig_Service = null; if (cmdletContext.ResourceConfig_Service != null) { requestResourceConfig_resourceConfig_Service = cmdletContext.ResourceConfig_Service; } if (requestResourceConfig_resourceConfig_Service != null) { request.ResourceConfig.Service = requestResourceConfig_resourceConfig_Service; requestResourceConfigIsNull = false; } System.String requestResourceConfig_resourceConfig_TransformSchema = null; if (cmdletContext.ResourceConfig_TransformSchema != null) { requestResourceConfig_resourceConfig_TransformSchema = cmdletContext.ResourceConfig_TransformSchema; } if (requestResourceConfig_resourceConfig_TransformSchema != null) { request.ResourceConfig.TransformSchema = requestResourceConfig_resourceConfig_TransformSchema; requestResourceConfigIsNull = false; } Amazon.AmplifyBackend.Model.BackendAPIConflictResolution requestResourceConfig_resourceConfig_ConflictResolution = null; // populate ConflictResolution var requestResourceConfig_resourceConfig_ConflictResolutionIsNull = true; requestResourceConfig_resourceConfig_ConflictResolution = new Amazon.AmplifyBackend.Model.BackendAPIConflictResolution(); Amazon.AmplifyBackend.ResolutionStrategy requestResourceConfig_resourceConfig_ConflictResolution_conflictResolution_ResolutionStrategy = null; if (cmdletContext.ConflictResolution_ResolutionStrategy != null) { requestResourceConfig_resourceConfig_ConflictResolution_conflictResolution_ResolutionStrategy = cmdletContext.ConflictResolution_ResolutionStrategy; } if (requestResourceConfig_resourceConfig_ConflictResolution_conflictResolution_ResolutionStrategy != null) { requestResourceConfig_resourceConfig_ConflictResolution.ResolutionStrategy = requestResourceConfig_resourceConfig_ConflictResolution_conflictResolution_ResolutionStrategy; requestResourceConfig_resourceConfig_ConflictResolutionIsNull = false; } // determine if requestResourceConfig_resourceConfig_ConflictResolution should be set to null if (requestResourceConfig_resourceConfig_ConflictResolutionIsNull) { requestResourceConfig_resourceConfig_ConflictResolution = null; } if (requestResourceConfig_resourceConfig_ConflictResolution != null) { request.ResourceConfig.ConflictResolution = requestResourceConfig_resourceConfig_ConflictResolution; requestResourceConfigIsNull = false; } Amazon.AmplifyBackend.Model.BackendAPIAuthType requestResourceConfig_resourceConfig_DefaultAuthType = null; // populate DefaultAuthType var requestResourceConfig_resourceConfig_DefaultAuthTypeIsNull = true; requestResourceConfig_resourceConfig_DefaultAuthType = new Amazon.AmplifyBackend.Model.BackendAPIAuthType(); Amazon.AmplifyBackend.Mode requestResourceConfig_resourceConfig_DefaultAuthType_defaultAuthType_Mode = null; if (cmdletContext.DefaultAuthType_Mode != null) { requestResourceConfig_resourceConfig_DefaultAuthType_defaultAuthType_Mode = cmdletContext.DefaultAuthType_Mode; } if (requestResourceConfig_resourceConfig_DefaultAuthType_defaultAuthType_Mode != null) { requestResourceConfig_resourceConfig_DefaultAuthType.Mode = requestResourceConfig_resourceConfig_DefaultAuthType_defaultAuthType_Mode; requestResourceConfig_resourceConfig_DefaultAuthTypeIsNull = false; } Amazon.AmplifyBackend.Model.BackendAPIAppSyncAuthSettings requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings = null; // populate Settings var requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = true; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings = new Amazon.AmplifyBackend.Model.BackendAPIAppSyncAuthSettings(); System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_CognitoUserPoolId = null; if (cmdletContext.Settings_CognitoUserPoolId != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_CognitoUserPoolId = cmdletContext.Settings_CognitoUserPoolId; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_CognitoUserPoolId != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.CognitoUserPoolId = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_CognitoUserPoolId; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_Description = null; if (cmdletContext.Settings_Description != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_Description = cmdletContext.Settings_Description; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_Description != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.Description = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_Description; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.Double?requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_ExpirationTime = null; if (cmdletContext.Settings_ExpirationTime != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_ExpirationTime = cmdletContext.Settings_ExpirationTime.Value; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_ExpirationTime != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.ExpirationTime = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_ExpirationTime.Value; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDAuthTTL = null; if (cmdletContext.Settings_OpenIDAuthTTL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDAuthTTL = cmdletContext.Settings_OpenIDAuthTTL; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDAuthTTL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.OpenIDAuthTTL = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDAuthTTL; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDClientId = null; if (cmdletContext.Settings_OpenIDClientId != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDClientId = cmdletContext.Settings_OpenIDClientId; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDClientId != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.OpenIDClientId = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDClientId; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIatTTL = null; if (cmdletContext.Settings_OpenIDIatTTL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIatTTL = cmdletContext.Settings_OpenIDIatTTL; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIatTTL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.OpenIDIatTTL = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIatTTL; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIssueURL = null; if (cmdletContext.Settings_OpenIDIssueURL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIssueURL = cmdletContext.Settings_OpenIDIssueURL; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIssueURL != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.OpenIDIssueURL = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDIssueURL; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } System.String requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDProviderName = null; if (cmdletContext.Settings_OpenIDProviderName != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDProviderName = cmdletContext.Settings_OpenIDProviderName; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDProviderName != null) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings.OpenIDProviderName = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings_settings_OpenIDProviderName; requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull = false; } // determine if requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings should be set to null if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_SettingsIsNull) { requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings = null; } if (requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings != null) { requestResourceConfig_resourceConfig_DefaultAuthType.Settings = requestResourceConfig_resourceConfig_DefaultAuthType_resourceConfig_DefaultAuthType_Settings; requestResourceConfig_resourceConfig_DefaultAuthTypeIsNull = false; } // determine if requestResourceConfig_resourceConfig_DefaultAuthType should be set to null if (requestResourceConfig_resourceConfig_DefaultAuthTypeIsNull) { requestResourceConfig_resourceConfig_DefaultAuthType = null; } if (requestResourceConfig_resourceConfig_DefaultAuthType != null) { request.ResourceConfig.DefaultAuthType = requestResourceConfig_resourceConfig_DefaultAuthType; requestResourceConfigIsNull = false; } // determine if request.ResourceConfig should be set to null if (requestResourceConfigIsNull) { request.ResourceConfig = null; } if (cmdletContext.ResourceName != null) { request.ResourceName = cmdletContext.ResourceName; } 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); }