/// <summary> /// Returns the enrollment (opt in) status of an account to the AWS Compute Optimizer /// service. /// /// /// <para> /// If the account is the master account of an organization, this action also confirms /// the enrollment status of member accounts within the organization. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetEnrollmentStatus service method.</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 GetEnrollmentStatus service method, as returned by ComputeOptimizer.</returns> /// <exception cref="Amazon.ComputeOptimizer.Model.AccessDeniedException"> /// You do not have sufficient access to perform this action. /// </exception> /// <exception cref="Amazon.ComputeOptimizer.Model.InternalServerException"> /// An internal error has occurred. Try your call again. /// </exception> /// <exception cref="Amazon.ComputeOptimizer.Model.InvalidParameterValueException"> /// An invalid or out-of-range value was supplied for the input parameter. /// </exception> /// <exception cref="Amazon.ComputeOptimizer.Model.MissingAuthenticationTokenException"> /// The request must contain either a valid (registered) AWS access key ID or X.509 certificate. /// </exception> /// <exception cref="Amazon.ComputeOptimizer.Model.ServiceUnavailableException"> /// The request has failed due to a temporary failure of the server. /// </exception> /// <exception cref="Amazon.ComputeOptimizer.Model.ThrottlingException"> /// The request was denied due to request throttling. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/compute-optimizer-2019-11-01/GetEnrollmentStatus">REST API Reference for GetEnrollmentStatus Operation</seealso> public virtual Task<GetEnrollmentStatusResponse> GetEnrollmentStatusAsync(GetEnrollmentStatusRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetEnrollmentStatusRequestMarshaller.Instance; options.ResponseUnmarshaller = GetEnrollmentStatusResponseUnmarshaller.Instance; return InvokeAsync<GetEnrollmentStatusResponse>(request, options, cancellationToken); }
internal virtual GetEnrollmentStatusResponse GetEnrollmentStatus(GetEnrollmentStatusRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetEnrollmentStatusRequestMarshaller.Instance; options.ResponseUnmarshaller = GetEnrollmentStatusResponseUnmarshaller.Instance; return Invoke<GetEnrollmentStatusResponse>(request, options); }
/// <summary> /// Initiates the asynchronous execution of the GetEnrollmentStatus operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetEnrollmentStatus operation on AmazonComputeOptimizerClient.</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 EndGetEnrollmentStatus /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/compute-optimizer-2019-11-01/GetEnrollmentStatus">REST API Reference for GetEnrollmentStatus Operation</seealso> public virtual IAsyncResult BeginGetEnrollmentStatus(GetEnrollmentStatusRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = GetEnrollmentStatusRequestMarshaller.Instance; options.ResponseUnmarshaller = GetEnrollmentStatusResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
private void HandleOutput(GetEnrollmentStatusRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForEnrollmentStatus(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetEnrollmentStatus(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.EnrollmentStatus); }
protected override void ProcessRecord() { base.ProcessRecord(); GetEnrollmentStatusRequest request; try { request = new GetEnrollmentStatusRequest { EnrollmentStatusId = EnrollmentStatusId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// <p>Returns the enrollment (opt in) status of an account to the AWS Compute Optimizer service.</p> <p>If the account is a master account of an organization, this operation also confirms the enrollment status of member accounts within the organization.</p> /// GetEnrollmentStatus /#X-Amz-Target=ComputeOptimizerService.GetEnrollmentStatus /// </summary> /// <returns>Success</returns> public async Task <GetEnrollmentStatusResponse> GetEnrollmentStatusAsync(GetEnrollmentStatusRequest requestBody, Action <System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null) { var requestUri = "/#X-Amz-Target=ComputeOptimizerService.GetEnrollmentStatus"; using (var request = new HttpRequestMessage(HttpMethod.Post, requestUri)) { using (var requestWriter = new System.IO.StringWriter()) { var requestSerializer = JsonSerializer.Create(jsonSerializerSettings); requestSerializer.Serialize(requestWriter, requestBody); var content = new StringContent(requestWriter.ToString(), System.Text.Encoding.UTF8, "application/json"); request.Content = content; if (handleHeaders != null) { handleHeaders(request.Headers); } var responseMessage = await client.SendAsync(request); try { responseMessage.EnsureSuccessStatusCodeEx(); var stream = await responseMessage.Content.ReadAsStreamAsync(); using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream))) { var serializer = new JsonSerializer(); return(serializer.Deserialize <GetEnrollmentStatusResponse>(jsonReader)); } } finally { responseMessage.Dispose(); } } } }
/// <summary> /// Creates a waiter using the provided configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="config">Wait Configuration</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetEnrollmentStatusRequest, GetEnrollmentStatusResponse> ForEnrollmentStatus(GetEnrollmentStatusRequest request, WaiterConfiguration config, params LifecycleState[] targetStates) { var agent = new WaiterAgent <GetEnrollmentStatusRequest, GetEnrollmentStatusResponse>( request, request => client.GetEnrollmentStatus(request), response => targetStates.Contains(response.EnrollmentStatus.LifecycleState.Value), targetStates.Contains(LifecycleState.Deleted) ); return(new Waiter <GetEnrollmentStatusRequest, GetEnrollmentStatusResponse>(config, agent)); }
/// <summary> /// Creates a waiter using default wait configuration. /// </summary> /// <param name="request">Request to send.</param> /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param> /// <returns>a new Oci.common.Waiter instance</returns> public Waiter <GetEnrollmentStatusRequest, GetEnrollmentStatusResponse> ForEnrollmentStatus(GetEnrollmentStatusRequest request, params LifecycleState[] targetStates) { return(this.ForEnrollmentStatus(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }