Exemple #1
0
 private Amazon.ConfigService.Model.PutStoredQueryResponse CallAWSServiceOperation(IAmazonConfigService client, Amazon.ConfigService.Model.PutStoredQueryRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Config", "PutStoredQuery");
     try
     {
         #if DESKTOP
         return(client.PutStoredQuery(request));
         #elif CORECLR
         return(client.PutStoredQueryAsync(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;
     }
 }
Exemple #2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ConfigService.Model.PutStoredQueryRequest();


            // populate StoredQuery
            var requestStoredQueryIsNull = true;

            request.StoredQuery = new Amazon.ConfigService.Model.StoredQuery();
            System.String requestStoredQuery_storedQuery_Description = null;
            if (cmdletContext.StoredQuery_Description != null)
            {
                requestStoredQuery_storedQuery_Description = cmdletContext.StoredQuery_Description;
            }
            if (requestStoredQuery_storedQuery_Description != null)
            {
                request.StoredQuery.Description = requestStoredQuery_storedQuery_Description;
                requestStoredQueryIsNull        = false;
            }
            System.String requestStoredQuery_storedQuery_Expression = null;
            if (cmdletContext.StoredQuery_Expression != null)
            {
                requestStoredQuery_storedQuery_Expression = cmdletContext.StoredQuery_Expression;
            }
            if (requestStoredQuery_storedQuery_Expression != null)
            {
                request.StoredQuery.Expression = requestStoredQuery_storedQuery_Expression;
                requestStoredQueryIsNull       = false;
            }
            System.String requestStoredQuery_storedQuery_QueryArn = null;
            if (cmdletContext.StoredQuery_QueryArn != null)
            {
                requestStoredQuery_storedQuery_QueryArn = cmdletContext.StoredQuery_QueryArn;
            }
            if (requestStoredQuery_storedQuery_QueryArn != null)
            {
                request.StoredQuery.QueryArn = requestStoredQuery_storedQuery_QueryArn;
                requestStoredQueryIsNull     = false;
            }
            System.String requestStoredQuery_storedQuery_QueryId = null;
            if (cmdletContext.StoredQuery_QueryId != null)
            {
                requestStoredQuery_storedQuery_QueryId = cmdletContext.StoredQuery_QueryId;
            }
            if (requestStoredQuery_storedQuery_QueryId != null)
            {
                request.StoredQuery.QueryId = requestStoredQuery_storedQuery_QueryId;
                requestStoredQueryIsNull    = false;
            }
            System.String requestStoredQuery_storedQuery_QueryName = null;
            if (cmdletContext.StoredQuery_QueryName != null)
            {
                requestStoredQuery_storedQuery_QueryName = cmdletContext.StoredQuery_QueryName;
            }
            if (requestStoredQuery_storedQuery_QueryName != null)
            {
                request.StoredQuery.QueryName = requestStoredQuery_storedQuery_QueryName;
                requestStoredQueryIsNull      = false;
            }
            // determine if request.StoredQuery should be set to null
            if (requestStoredQueryIsNull)
            {
                request.StoredQuery = null;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

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