Beispiel #1
0
 private Amazon.RDS.Model.ModifyDBProxyTargetGroupResponse CallAWSServiceOperation(IAmazonRDS client, Amazon.RDS.Model.ModifyDBProxyTargetGroupRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Relational Database Service", "ModifyDBProxyTargetGroup");
     try
     {
         #if DESKTOP
         return(client.ModifyDBProxyTargetGroup(request));
         #elif CORECLR
         return(client.ModifyDBProxyTargetGroupAsync(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;
     }
 }
Beispiel #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.RDS.Model.ModifyDBProxyTargetGroupRequest();


            // populate ConnectionPoolConfig
            var requestConnectionPoolConfigIsNull = true;

            request.ConnectionPoolConfig = new Amazon.RDS.Model.ConnectionPoolConfiguration();
            System.Int32?requestConnectionPoolConfig_connectionPoolConfig_ConnectionBorrowTimeout = null;
            if (cmdletContext.ConnectionPoolConfig_ConnectionBorrowTimeout != null)
            {
                requestConnectionPoolConfig_connectionPoolConfig_ConnectionBorrowTimeout = cmdletContext.ConnectionPoolConfig_ConnectionBorrowTimeout.Value;
            }
            if (requestConnectionPoolConfig_connectionPoolConfig_ConnectionBorrowTimeout != null)
            {
                request.ConnectionPoolConfig.ConnectionBorrowTimeout = requestConnectionPoolConfig_connectionPoolConfig_ConnectionBorrowTimeout.Value;
                requestConnectionPoolConfigIsNull = false;
            }
            System.String requestConnectionPoolConfig_connectionPoolConfig_InitQuery = null;
            if (cmdletContext.ConnectionPoolConfig_InitQuery != null)
            {
                requestConnectionPoolConfig_connectionPoolConfig_InitQuery = cmdletContext.ConnectionPoolConfig_InitQuery;
            }
            if (requestConnectionPoolConfig_connectionPoolConfig_InitQuery != null)
            {
                request.ConnectionPoolConfig.InitQuery = requestConnectionPoolConfig_connectionPoolConfig_InitQuery;
                requestConnectionPoolConfigIsNull      = false;
            }
            System.Int32?requestConnectionPoolConfig_connectionPoolConfig_MaxConnectionsPercent = null;
            if (cmdletContext.ConnectionPoolConfig_MaxConnectionsPercent != null)
            {
                requestConnectionPoolConfig_connectionPoolConfig_MaxConnectionsPercent = cmdletContext.ConnectionPoolConfig_MaxConnectionsPercent.Value;
            }
            if (requestConnectionPoolConfig_connectionPoolConfig_MaxConnectionsPercent != null)
            {
                request.ConnectionPoolConfig.MaxConnectionsPercent = requestConnectionPoolConfig_connectionPoolConfig_MaxConnectionsPercent.Value;
                requestConnectionPoolConfigIsNull = false;
            }
            System.Int32?requestConnectionPoolConfig_connectionPoolConfig_MaxIdleConnectionsPercent = null;
            if (cmdletContext.ConnectionPoolConfig_MaxIdleConnectionsPercent != null)
            {
                requestConnectionPoolConfig_connectionPoolConfig_MaxIdleConnectionsPercent = cmdletContext.ConnectionPoolConfig_MaxIdleConnectionsPercent.Value;
            }
            if (requestConnectionPoolConfig_connectionPoolConfig_MaxIdleConnectionsPercent != null)
            {
                request.ConnectionPoolConfig.MaxIdleConnectionsPercent = requestConnectionPoolConfig_connectionPoolConfig_MaxIdleConnectionsPercent.Value;
                requestConnectionPoolConfigIsNull = false;
            }
            List <System.String> requestConnectionPoolConfig_connectionPoolConfig_SessionPinningFilter = null;

            if (cmdletContext.ConnectionPoolConfig_SessionPinningFilter != null)
            {
                requestConnectionPoolConfig_connectionPoolConfig_SessionPinningFilter = cmdletContext.ConnectionPoolConfig_SessionPinningFilter;
            }
            if (requestConnectionPoolConfig_connectionPoolConfig_SessionPinningFilter != null)
            {
                request.ConnectionPoolConfig.SessionPinningFilters = requestConnectionPoolConfig_connectionPoolConfig_SessionPinningFilter;
                requestConnectionPoolConfigIsNull = false;
            }
            // determine if request.ConnectionPoolConfig should be set to null
            if (requestConnectionPoolConfigIsNull)
            {
                request.ConnectionPoolConfig = null;
            }
            if (cmdletContext.DBProxyName != null)
            {
                request.DBProxyName = cmdletContext.DBProxyName;
            }
            if (cmdletContext.NewName != null)
            {
                request.NewName = cmdletContext.NewName;
            }
            if (cmdletContext.TargetGroupName != null)
            {
                request.TargetGroupName = cmdletContext.TargetGroupName;
            }

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