コード例 #1
0
 private Amazon.MemoryDB.Model.UpdateClusterResponse CallAWSServiceOperation(IAmazonMemoryDB client, Amazon.MemoryDB.Model.UpdateClusterRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon MemoryDB", "UpdateCluster");
     try
     {
         #if DESKTOP
         return(client.UpdateCluster(request));
         #elif CORECLR
         return(client.UpdateClusterAsync(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;
     }
 }
コード例 #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.MemoryDB.Model.UpdateClusterRequest();

            if (cmdletContext.ACLName != null)
            {
                request.ACLName = cmdletContext.ACLName;
            }
            if (cmdletContext.ClusterName != null)
            {
                request.ClusterName = cmdletContext.ClusterName;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.EngineVersion != null)
            {
                request.EngineVersion = cmdletContext.EngineVersion;
            }
            if (cmdletContext.MaintenanceWindow != null)
            {
                request.MaintenanceWindow = cmdletContext.MaintenanceWindow;
            }
            if (cmdletContext.NodeType != null)
            {
                request.NodeType = cmdletContext.NodeType;
            }
            if (cmdletContext.ParameterGroupName != null)
            {
                request.ParameterGroupName = cmdletContext.ParameterGroupName;
            }

            // populate ReplicaConfiguration
            var requestReplicaConfigurationIsNull = true;

            request.ReplicaConfiguration = new Amazon.MemoryDB.Model.ReplicaConfigurationRequest();
            System.Int32?requestReplicaConfiguration_replicaConfiguration_ReplicaCount = null;
            if (cmdletContext.ReplicaConfiguration_ReplicaCount != null)
            {
                requestReplicaConfiguration_replicaConfiguration_ReplicaCount = cmdletContext.ReplicaConfiguration_ReplicaCount.Value;
            }
            if (requestReplicaConfiguration_replicaConfiguration_ReplicaCount != null)
            {
                request.ReplicaConfiguration.ReplicaCount = requestReplicaConfiguration_replicaConfiguration_ReplicaCount.Value;
                requestReplicaConfigurationIsNull         = false;
            }
            // determine if request.ReplicaConfiguration should be set to null
            if (requestReplicaConfigurationIsNull)
            {
                request.ReplicaConfiguration = null;
            }
            if (cmdletContext.SecurityGroupId != null)
            {
                request.SecurityGroupIds = cmdletContext.SecurityGroupId;
            }

            // populate ShardConfiguration
            var requestShardConfigurationIsNull = true;

            request.ShardConfiguration = new Amazon.MemoryDB.Model.ShardConfigurationRequest();
            System.Int32?requestShardConfiguration_shardConfiguration_ShardCount = null;
            if (cmdletContext.ShardConfiguration_ShardCount != null)
            {
                requestShardConfiguration_shardConfiguration_ShardCount = cmdletContext.ShardConfiguration_ShardCount.Value;
            }
            if (requestShardConfiguration_shardConfiguration_ShardCount != null)
            {
                request.ShardConfiguration.ShardCount = requestShardConfiguration_shardConfiguration_ShardCount.Value;
                requestShardConfigurationIsNull       = false;
            }
            // determine if request.ShardConfiguration should be set to null
            if (requestShardConfigurationIsNull)
            {
                request.ShardConfiguration = null;
            }
            if (cmdletContext.SnapshotRetentionLimit != null)
            {
                request.SnapshotRetentionLimit = cmdletContext.SnapshotRetentionLimit.Value;
            }
            if (cmdletContext.SnapshotWindow != null)
            {
                request.SnapshotWindow = cmdletContext.SnapshotWindow;
            }
            if (cmdletContext.SnsTopicArn != null)
            {
                request.SnsTopicArn = cmdletContext.SnsTopicArn;
            }
            if (cmdletContext.SnsTopicStatus != null)
            {
                request.SnsTopicStatus = cmdletContext.SnsTopicStatus;
            }

            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);
        }