protected override void ProcessRecord() { AmazonRDS client = base.GetClient(); Amazon.RDS.Model.CreateDBSecurityGroupRequest request = new Amazon.RDS.Model.CreateDBSecurityGroupRequest(); request.DBSecurityGroupName = this._DBSecurityGroupName; request.DBSecurityGroupDescription = this._DBSecurityGroupDescription; Amazon.RDS.Model.CreateDBSecurityGroupResponse response = client.CreateDBSecurityGroup(request); base.WriteObject(response.CreateDBSecurityGroupResult, true); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.RDS.Model.CreateDBSecurityGroupRequest(); if (cmdletContext.DBSecurityGroupDescription != null) { request.DBSecurityGroupDescription = cmdletContext.DBSecurityGroupDescription; } if (cmdletContext.DBSecurityGroupName != null) { request.DBSecurityGroupName = cmdletContext.DBSecurityGroupName; } 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); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSecurityGroup operation. /// <seealso cref="Amazon.RDS.AmazonRDS.CreateDBSecurityGroup"/> /// </summary> /// /// <param name="createDBSecurityGroupRequest">Container for the necessary parameters to execute the CreateDBSecurityGroup operation on /// AmazonRDS.</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 /// EndCreateDBSecurityGroup operation.</returns> public IAsyncResult BeginCreateDBSecurityGroup(CreateDBSecurityGroupRequest createDBSecurityGroupRequest, AsyncCallback callback, object state) { return invokeCreateDBSecurityGroup(createDBSecurityGroupRequest, callback, state, false); }
IAsyncResult invokeCreateDBSecurityGroup(CreateDBSecurityGroupRequest createDBSecurityGroupRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new CreateDBSecurityGroupRequestMarshaller().Marshall(createDBSecurityGroupRequest); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> Creates a new DB Security Group. DB Security Groups control access to a DB Instance. </para> /// </summary> /// /// <param name="createDBSecurityGroupRequest">Container for the necessary parameters to execute the CreateDBSecurityGroup service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBSecurityGroupQuotaExceededException"/> /// <exception cref="DBSecurityGroupNotSupportedException"/> /// <exception cref="DBSecurityGroupAlreadyExistsException"/> public CreateDBSecurityGroupResponse CreateDBSecurityGroup(CreateDBSecurityGroupRequest createDBSecurityGroupRequest) { IAsyncResult asyncResult = invokeCreateDBSecurityGroup(createDBSecurityGroupRequest, null, null, true); return EndCreateDBSecurityGroup(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSecurityGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup 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<CreateDBSecurityGroupResponse> CreateDBSecurityGroupAsync(CreateDBSecurityGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSecurityGroupRequestMarshaller(); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.Instance; return InvokeAsync<CreateDBSecurityGroupRequest,CreateDBSecurityGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Creates a new DB security group. DB security groups control access to a DB instance. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup service method.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by RDS.</returns> /// <exception cref="Amazon.RDS.Model.DBSecurityGroupAlreadyExistsException"> /// A DB security group with the name specified in <i>DBSecurityGroupName</i> already /// exists. /// </exception> /// <exception cref="Amazon.RDS.Model.DBSecurityGroupNotSupportedException"> /// A DB security group is not allowed for this action. /// </exception> /// <exception cref="Amazon.RDS.Model.DBSecurityGroupQuotaExceededException"> /// Request would result in user exceeding the allowed number of DB security groups. /// </exception> public CreateDBSecurityGroupResponse CreateDBSecurityGroup(CreateDBSecurityGroupRequest request) { var marshaller = new CreateDBSecurityGroupRequestMarshaller(); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.Instance; return Invoke<CreateDBSecurityGroupRequest,CreateDBSecurityGroupResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSecurityGroup operation. /// <seealso cref="Amazon.RDS.IAmazonRDS.CreateDBSecurityGroup"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup 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<CreateDBSecurityGroupResponse> CreateDBSecurityGroupAsync(CreateDBSecurityGroupRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSecurityGroupRequestMarshaller(); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.GetInstance(); return Invoke<IRequest, CreateDBSecurityGroupRequest, CreateDBSecurityGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para> Creates a new DB security group. DB security groups control access to a DB instance. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupNotSupportedException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupAlreadyExistsException" /> public CreateDBSecurityGroupResponse CreateDBSecurityGroup(CreateDBSecurityGroupRequest request) { var task = CreateDBSecurityGroupAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.RDS.Model.CreateDBSecurityGroupResponse CallAWSServiceOperation(IAmazonRDS client, Amazon.RDS.Model.CreateDBSecurityGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Relational Database Service", "CreateDBSecurityGroup"); try { #if DESKTOP return(client.CreateDBSecurityGroup(request)); #elif CORECLR return(client.CreateDBSecurityGroupAsync(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; } }
/// <summary> /// <para> Creates a new DB security group. DB security groups control access to a DB instance. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupNotSupportedException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupAlreadyExistsException" /> public CreateDBSecurityGroupResponse CreateDBSecurityGroup(CreateDBSecurityGroupRequest request) { var task = CreateDBSecurityGroupAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para> Creates a new DB security group. DB security groups control access to a DB instance. </para> /// </summary> /// /// <param name="createDBSecurityGroupRequest">Container for the necessary parameters to execute the CreateDBSecurityGroup service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by AmazonRDS.</returns> /// /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupQuotaExceededException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupNotSupportedException" /> /// <exception cref="T:Amazon.RDS.Model.DBSecurityGroupAlreadyExistsException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<CreateDBSecurityGroupResponse> CreateDBSecurityGroupAsync(CreateDBSecurityGroupRequest createDBSecurityGroupRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDBSecurityGroupRequestMarshaller(); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, CreateDBSecurityGroupRequest, CreateDBSecurityGroupResponse>(createDBSecurityGroupRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Initiates the asynchronous execution of the CreateDBSecurityGroup operation. /// <seealso cref="Amazon.RDS.IAmazonRDS"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDBSecurityGroup operation on AmazonRDSClient.</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 EndCreateDBSecurityGroup /// operation.</returns> public IAsyncResult BeginCreateDBSecurityGroup(CreateDBSecurityGroupRequest request, AsyncCallback callback, object state) { var marshaller = new CreateDBSecurityGroupRequestMarshaller(); var unmarshaller = CreateDBSecurityGroupResponseUnmarshaller.Instance; return BeginInvoke<CreateDBSecurityGroupRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para> Creates a new DB Security Group. DB Security Groups control access to a DB Instance. </para> /// </summary> /// /// <param name="createDBSecurityGroupRequest">Container for the necessary parameters to execute the CreateDBSecurityGroup service method on /// AmazonRDS.</param> /// /// <returns>The response from the CreateDBSecurityGroup service method, as returned by AmazonRDS.</returns> /// /// <exception cref="DBSecurityGroupQuotaExceededException"/> /// <exception cref="DBSecurityGroupAlreadyExistsException"/> public CreateDBSecurityGroupResponse CreateDBSecurityGroup(CreateDBSecurityGroupRequest createDBSecurityGroupRequest) { IRequest<CreateDBSecurityGroupRequest> request = new CreateDBSecurityGroupRequestMarshaller().Marshall(createDBSecurityGroupRequest); CreateDBSecurityGroupResponse response = Invoke<CreateDBSecurityGroupRequest, CreateDBSecurityGroupResponse> (request, this.signer, CreateDBSecurityGroupResponseUnmarshaller.GetInstance()); return response; }