public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ElastiCache.Model.ModifyGlobalReplicationGroupRequest(); if (cmdletContext.ApplyImmediately != null) { request.ApplyImmediately = cmdletContext.ApplyImmediately.Value; } if (cmdletContext.AutomaticFailoverEnabled != null) { request.AutomaticFailoverEnabled = cmdletContext.AutomaticFailoverEnabled.Value; } if (cmdletContext.CacheNodeType != null) { request.CacheNodeType = cmdletContext.CacheNodeType; } if (cmdletContext.CacheParameterGroupName != null) { request.CacheParameterGroupName = cmdletContext.CacheParameterGroupName; } if (cmdletContext.EngineVersion != null) { request.EngineVersion = cmdletContext.EngineVersion; } if (cmdletContext.GlobalReplicationGroupDescription != null) { request.GlobalReplicationGroupDescription = cmdletContext.GlobalReplicationGroupDescription; } if (cmdletContext.GlobalReplicationGroupId != null) { request.GlobalReplicationGroupId = cmdletContext.GlobalReplicationGroupId; } 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); }
private Amazon.ElastiCache.Model.ModifyGlobalReplicationGroupResponse CallAWSServiceOperation(IAmazonElastiCache client, Amazon.ElastiCache.Model.ModifyGlobalReplicationGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon ElastiCache", "ModifyGlobalReplicationGroup"); try { #if DESKTOP return(client.ModifyGlobalReplicationGroup(request)); #elif CORECLR return(client.ModifyGlobalReplicationGroupAsync(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; } }