Container for the parameters to the CreateResourceGroup operation. Creates a resource group using the specified set of tags (key and value pairs) that are used to select the EC2 instances to be included in an Amazon Inspector assessment target. The created resource group is then used to create an Amazon Inspector assessment target. For more information, see CreateAssessmentTarget.
Inheritance: AmazonInspectorRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Inspector.Model.CreateResourceGroupRequest();

            if (cmdletContext.ResourceGroupTag != null)
            {
                request.ResourceGroupTags = cmdletContext.ResourceGroupTag;
            }

            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);
        }
Esempio n. 2
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateResourceGroup operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateResourceGroup operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<CreateResourceGroupResponse> CreateResourceGroupAsync(CreateResourceGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new CreateResourceGroupRequestMarshaller();
            var unmarshaller = CreateResourceGroupResponseUnmarshaller.Instance;

            return InvokeAsync<CreateResourceGroupRequest,CreateResourceGroupResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a resource group using the specified set of tags (key and value pairs) that
        /// are used to select the EC2 instances to be included in an Amazon Inspector assessment
        /// target. The created resource group is then used to create an Amazon Inspector assessment
        /// target. For more information, see <a>CreateAssessmentTarget</a>.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the CreateResourceGroup service method.</param>
        /// 
        /// <returns>The response from the CreateResourceGroup service method, as returned by Inspector.</returns>
        /// <exception cref="Amazon.Inspector.Model.AccessDeniedException">
        /// You do not have required permissions to access the requested resource.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.InternalException">
        /// Internal server error.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.InvalidInputException">
        /// The request was rejected because an invalid or out-of-range value was supplied for
        /// an input parameter.
        /// </exception>
        /// <exception cref="Amazon.Inspector.Model.LimitExceededException">
        /// The request was rejected because it attempted to create resources beyond the current
        /// AWS account limits. The error code describes the limit exceeded.
        /// </exception>
        public CreateResourceGroupResponse CreateResourceGroup(CreateResourceGroupRequest request)
        {
            var marshaller = new CreateResourceGroupRequestMarshaller();
            var unmarshaller = CreateResourceGroupResponseUnmarshaller.Instance;

            return Invoke<CreateResourceGroupRequest,CreateResourceGroupResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Creates a resource group using the specified set of tags (key and value pairs) that
 /// are used to select the EC2 instances to be included in an Inspector application. The
 /// created resource group is then used to create an Inspector application.
 /// </summary>
 /// <param name="resourceGroupTags">A collection of keys and an array of possible values in JSON format. For example, [{ "key1" : ["Value1","Value2"]},{"Key2": ["Value3"]}]</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the CreateResourceGroup service method, as returned by Inspector.</returns>
 /// <exception cref="Amazon.Inspector.Model.AccessDeniedException">
 /// 
 /// </exception>
 /// <exception cref="Amazon.Inspector.Model.InternalException">
 /// 
 /// </exception>
 /// <exception cref="Amazon.Inspector.Model.InvalidInputException">
 /// 
 /// </exception>
 public Task<CreateResourceGroupResponse> CreateResourceGroupAsync(string resourceGroupTags, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new CreateResourceGroupRequest();
     request.ResourceGroupTags = resourceGroupTags;
     return CreateResourceGroupAsync(request, cancellationToken);
 }
Esempio n. 5
0
        /// <summary>
        /// Initiates the asynchronous execution of the CreateResourceGroup operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the CreateResourceGroup operation on AmazonInspectorClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateResourceGroup
        ///         operation.</returns>
        public IAsyncResult BeginCreateResourceGroup(CreateResourceGroupRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new CreateResourceGroupRequestMarshaller();
            var unmarshaller = CreateResourceGroupResponseUnmarshaller.Instance;

            return BeginInvoke<CreateResourceGroupRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 /// <summary>
 /// Creates a resource group using the specified set of tags (key and value pairs) that
 /// are used to select the EC2 instances to be included in an Inspector application. The
 /// created resource group is then used to create an Inspector application.
 /// </summary>
 /// <param name="resourceGroupTags">A collection of keys and an array of possible values in JSON format. For example, [{ "key1" : ["Value1","Value2"]},{"Key2": ["Value3"]}]</param>
 /// 
 /// <returns>The response from the CreateResourceGroup service method, as returned by Inspector.</returns>
 /// <exception cref="Amazon.Inspector.Model.AccessDeniedException">
 /// 
 /// </exception>
 /// <exception cref="Amazon.Inspector.Model.InternalException">
 /// 
 /// </exception>
 /// <exception cref="Amazon.Inspector.Model.InvalidInputException">
 /// 
 /// </exception>
 public CreateResourceGroupResponse CreateResourceGroup(string resourceGroupTags)
 {
     var request = new CreateResourceGroupRequest();
     request.ResourceGroupTags = resourceGroupTags;
     return CreateResourceGroup(request);
 }
 private Amazon.Inspector.Model.CreateResourceGroupResponse CallAWSServiceOperation(IAmazonInspector client, Amazon.Inspector.Model.CreateResourceGroupRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Inspector", "CreateResourceGroup");
     try
     {
         #if DESKTOP
         return(client.CreateResourceGroup(request));
         #elif CORECLR
         return(client.CreateResourceGroupAsync(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;
     }
 }