protected override void ProcessRecord() { AmazonEC2 client = base.GetClient(); Amazon.EC2.Model.ModifySnapshotAttributeRequest request = new Amazon.EC2.Model.ModifySnapshotAttributeRequest(); request.SnapshotId = this._SnapshotId; request.Attribute = this._Attribute; request.OperationType = this._OperationType; if (string.IsNullOrEmpty(this._UserId)) { request.UserId.Add(this._UserId); } if (string.IsNullOrEmpty(this._UserGroup)) { request.UserGroup.Add(this._UserGroup); } Amazon.EC2.Model.ModifySnapshotAttributeResponse response = client.ModifySnapshotAttribute(request); }
/// <summary> /// Initiates the asynchronous execution of the ModifySnapshotAttribute operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifySnapshotAttribute 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<ModifySnapshotAttributeResponse> ModifySnapshotAttributeAsync(ModifySnapshotAttributeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifySnapshotAttributeRequestMarshaller(); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.Instance; return InvokeAsync<ModifySnapshotAttributeRequest,ModifySnapshotAttributeResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Adds or removes permission settings for the specified snapshot. You may add or remove /// specified AWS account IDs from a snapshot's list of create volume permissions, but /// you cannot do both in a single API call. If you need to both add and remove account /// IDs for a snapshot, you must use multiple API calls. /// /// /// <para> /// For more information on modifying snapshot permissions, see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html">Sharing /// Snapshots</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>. /// </para> /// <note> /// <para> /// Snapshots with AWS Marketplace product codes cannot be made public. /// </para> /// </note> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifySnapshotAttribute service method.</param> /// /// <returns>The response from the ModifySnapshotAttribute service method, as returned by EC2.</returns> public ModifySnapshotAttributeResponse ModifySnapshotAttribute(ModifySnapshotAttributeRequest request) { var marshaller = new ModifySnapshotAttributeRequestMarshaller(); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.Instance; return Invoke<ModifySnapshotAttributeRequest,ModifySnapshotAttributeResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ModifySnapshotAttribute operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifySnapshotAttribute operation on AmazonEC2Client.</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 EndModifySnapshotAttribute /// operation.</returns> public IAsyncResult BeginModifySnapshotAttribute(ModifySnapshotAttributeRequest request, AsyncCallback callback, object state) { var marshaller = new ModifySnapshotAttributeRequestMarshaller(); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.Instance; return BeginInvoke<ModifySnapshotAttributeRequest>(request, marshaller, unmarshaller, callback, state); }
IAsyncResult invokeModifySnapshotAttribute(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new ModifySnapshotAttributeRequestMarshaller().Marshall(modifySnapshotAttributeRequest); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the ModifySnapshotAttribute operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.ModifySnapshotAttribute"/> /// </summary> /// /// <param name="modifySnapshotAttributeRequest">Container for the necessary parameters to execute the ModifySnapshotAttribute operation on /// AmazonEC2.</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> public IAsyncResult BeginModifySnapshotAttribute(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest, AsyncCallback callback, object state) { return invokeModifySnapshotAttribute(modifySnapshotAttributeRequest, callback, state, false); }
/// <summary> /// <para>Adds or removes permission settings for the specified snapshot.</para> <para>For more information on modifying snapshot permissions, /// see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html" >Sharing Snapshots</a> in the /// <i>Amazon Elastic Compute Cloud User Guide</i> .</para> <para><b>NOTE:</b> Snapshots with AWS Marketplace product codes cannot be made /// public. </para> /// </summary> /// /// <param name="modifySnapshotAttributeRequest">Container for the necessary parameters to execute the ModifySnapshotAttribute service method on /// AmazonEC2.</param> /// public ModifySnapshotAttributeResponse ModifySnapshotAttribute(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest) { IAsyncResult asyncResult = invokeModifySnapshotAttribute(modifySnapshotAttributeRequest, null, null, true); return EndModifySnapshotAttribute(asyncResult); }
/// <summary> /// <para>Adds or removes permission settings for the specified snapshot.</para> <para>For more information on modifying snapshot permissions, /// see <a href="http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-modifying-snapshot-permissions.html">Sharing Snapshots</a> in the /// <i>Amazon Elastic Compute Cloud User Guide</i> .</para> <para><b>NOTE:</b> Snapshots with AWS Marketplace product codes cannot be made /// public. </para> /// </summary> /// /// <param name="modifySnapshotAttributeRequest">Container for the necessary parameters to execute the ModifySnapshotAttribute service method on /// AmazonEC2.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<ModifySnapshotAttributeResponse> ModifySnapshotAttributeAsync(ModifySnapshotAttributeRequest modifySnapshotAttributeRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifySnapshotAttributeRequestMarshaller(); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.GetInstance(); return Invoke<IRequest, ModifySnapshotAttributeRequest, ModifySnapshotAttributeResponse>(modifySnapshotAttributeRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal ModifySnapshotAttributeResponse ModifySnapshotAttribute(ModifySnapshotAttributeRequest request) { var task = ModifySnapshotAttributeAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the ModifySnapshotAttribute operation. /// <seealso cref="Amazon.EC2.IAmazonEC2.ModifySnapshotAttribute"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifySnapshotAttribute 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 async Task<ModifySnapshotAttributeResponse> ModifySnapshotAttributeAsync(ModifySnapshotAttributeRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifySnapshotAttributeRequestMarshaller(); var unmarshaller = ModifySnapshotAttributeResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, ModifySnapshotAttributeRequest, ModifySnapshotAttributeResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para> Adds or remove permission settings for the specified snapshot. </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifySnapshotAttribute service method on /// AmazonEC2.</param> public ModifySnapshotAttributeResponse ModifySnapshotAttribute(ModifySnapshotAttributeRequest request) { var task = ModifySnapshotAttributeAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.EC2.Model.ModifySnapshotAttributeResponse CallAWSServiceOperation(IAmazonEC2 client, Amazon.EC2.Model.ModifySnapshotAttributeRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic Compute Cloud (EC2)", "ModifySnapshotAttribute"); try { #if DESKTOP return(client.ModifySnapshotAttribute(request)); #elif CORECLR return(client.ModifySnapshotAttributeAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.EC2.Model.ModifySnapshotAttributeRequest(); if (cmdletContext.Attribute != null) { request.Attribute = cmdletContext.Attribute; } // populate CreateVolumePermission var requestCreateVolumePermissionIsNull = true; request.CreateVolumePermission = new Amazon.EC2.Model.CreateVolumePermissionModifications(); List <Amazon.EC2.Model.CreateVolumePermission> requestCreateVolumePermission_createVolumePermission_Add = null; if (cmdletContext.CreateVolumePermission_Add != null) { requestCreateVolumePermission_createVolumePermission_Add = cmdletContext.CreateVolumePermission_Add; } if (requestCreateVolumePermission_createVolumePermission_Add != null) { request.CreateVolumePermission.Add = requestCreateVolumePermission_createVolumePermission_Add; requestCreateVolumePermissionIsNull = false; } List <Amazon.EC2.Model.CreateVolumePermission> requestCreateVolumePermission_createVolumePermission_Remove = null; if (cmdletContext.CreateVolumePermission_Remove != null) { requestCreateVolumePermission_createVolumePermission_Remove = cmdletContext.CreateVolumePermission_Remove; } if (requestCreateVolumePermission_createVolumePermission_Remove != null) { request.CreateVolumePermission.Remove = requestCreateVolumePermission_createVolumePermission_Remove; requestCreateVolumePermissionIsNull = false; } // determine if request.CreateVolumePermission should be set to null if (requestCreateVolumePermissionIsNull) { request.CreateVolumePermission = null; } if (cmdletContext.GroupName != null) { request.GroupNames = cmdletContext.GroupName; } if (cmdletContext.OperationType != null) { request.OperationType = cmdletContext.OperationType; } if (cmdletContext.SnapshotId != null) { request.SnapshotId = cmdletContext.SnapshotId; } if (cmdletContext.UserId != null) { request.UserIds = cmdletContext.UserId; } 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); }