private Amazon.AppSync.Model.UpdateDataSourceResponse CallAWSServiceOperation(IAmazonAppSync client, Amazon.AppSync.Model.UpdateDataSourceRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS AppSync", "UpdateDataSource"); try { #if DESKTOP return(client.UpdateDataSource(request)); #elif CORECLR return(client.UpdateDataSourceAsync(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.AppSync.Model.UpdateDataSourceRequest(); if (cmdletContext.ApiId != null) { request.ApiId = cmdletContext.ApiId; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DynamodbConfig != null) { request.DynamodbConfig = cmdletContext.DynamodbConfig; } if (cmdletContext.ElasticsearchConfig != null) { request.ElasticsearchConfig = cmdletContext.ElasticsearchConfig; } // populate HttpConfig var requestHttpConfigIsNull = true; request.HttpConfig = new Amazon.AppSync.Model.HttpDataSourceConfig(); Amazon.AppSync.Model.AuthorizationConfig requestHttpConfig_httpConfig_AuthorizationConfig = null; if (cmdletContext.HttpConfig_AuthorizationConfig != null) { requestHttpConfig_httpConfig_AuthorizationConfig = cmdletContext.HttpConfig_AuthorizationConfig; } if (requestHttpConfig_httpConfig_AuthorizationConfig != null) { request.HttpConfig.AuthorizationConfig = requestHttpConfig_httpConfig_AuthorizationConfig; requestHttpConfigIsNull = false; } System.String requestHttpConfig_httpConfig_Endpoint = null; if (cmdletContext.HttpConfig_Endpoint != null) { requestHttpConfig_httpConfig_Endpoint = cmdletContext.HttpConfig_Endpoint; } if (requestHttpConfig_httpConfig_Endpoint != null) { request.HttpConfig.Endpoint = requestHttpConfig_httpConfig_Endpoint; requestHttpConfigIsNull = false; } // determine if request.HttpConfig should be set to null if (requestHttpConfigIsNull) { request.HttpConfig = null; } if (cmdletContext.LambdaConfig != null) { request.LambdaConfig = cmdletContext.LambdaConfig; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } // populate RelationalDatabaseConfig var requestRelationalDatabaseConfigIsNull = true; request.RelationalDatabaseConfig = new Amazon.AppSync.Model.RelationalDatabaseDataSourceConfig(); Amazon.AppSync.Model.RdsHttpEndpointConfig requestRelationalDatabaseConfig_relationalDatabaseConfig_RdsHttpEndpointConfig = null; if (cmdletContext.RelationalDatabaseConfig_RdsHttpEndpointConfig != null) { requestRelationalDatabaseConfig_relationalDatabaseConfig_RdsHttpEndpointConfig = cmdletContext.RelationalDatabaseConfig_RdsHttpEndpointConfig; } if (requestRelationalDatabaseConfig_relationalDatabaseConfig_RdsHttpEndpointConfig != null) { request.RelationalDatabaseConfig.RdsHttpEndpointConfig = requestRelationalDatabaseConfig_relationalDatabaseConfig_RdsHttpEndpointConfig; requestRelationalDatabaseConfigIsNull = false; } Amazon.AppSync.RelationalDatabaseSourceType requestRelationalDatabaseConfig_relationalDatabaseConfig_RelationalDatabaseSourceType = null; if (cmdletContext.RelationalDatabaseConfig_RelationalDatabaseSourceType != null) { requestRelationalDatabaseConfig_relationalDatabaseConfig_RelationalDatabaseSourceType = cmdletContext.RelationalDatabaseConfig_RelationalDatabaseSourceType; } if (requestRelationalDatabaseConfig_relationalDatabaseConfig_RelationalDatabaseSourceType != null) { request.RelationalDatabaseConfig.RelationalDatabaseSourceType = requestRelationalDatabaseConfig_relationalDatabaseConfig_RelationalDatabaseSourceType; requestRelationalDatabaseConfigIsNull = false; } // determine if request.RelationalDatabaseConfig should be set to null if (requestRelationalDatabaseConfigIsNull) { request.RelationalDatabaseConfig = null; } if (cmdletContext.ServiceRoleArn != null) { request.ServiceRoleArn = cmdletContext.ServiceRoleArn; } if (cmdletContext.Type != null) { request.Type = cmdletContext.Type; } 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); }