/// <summary> /// Initiates the asynchronous execution of the GetCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetCertificate 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/GetCertificate">REST API Reference for GetCertificate Operation</seealso> public virtual Task <GetCertificateResponse> GetCertificateAsync(GetCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetCertificateRequestMarshaller(); var unmarshaller = GetCertificateResponseUnmarshaller.Instance; return(InvokeAsync <GetCertificateRequest, GetCertificateResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the GetCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetCertificate operation on AmazonCertificateManagerClient.</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 EndGetCertificate /// operation.</returns> public IAsyncResult BeginGetCertificate(GetCertificateRequest request, AsyncCallback callback, object state) { var marshaller = new GetCertificateRequestMarshaller(); var unmarshaller = GetCertificateResponseUnmarshaller.Instance; return(BeginInvoke <GetCertificateRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the GetCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetCertificate 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/GetCertificate">REST API Reference for GetCertificate Operation</seealso> public virtual Task <GetCertificateResponse> GetCertificateAsync(GetCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetCertificateRequestMarshaller.Instance; options.ResponseUnmarshaller = GetCertificateResponseUnmarshaller.Instance; return(InvokeAsync <GetCertificateResponse>(request, options, cancellationToken)); }
internal virtual GetCertificateResponse GetCertificate(GetCertificateRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetCertificateRequestMarshaller.Instance; options.ResponseUnmarshaller = GetCertificateResponseUnmarshaller.Instance; return(Invoke <GetCertificateResponse>(request, options)); }
/// <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 <GetCertificateRequest, GetCertificateResponse> ForCertificate(GetCertificateRequest request, WaiterConfiguration config, params LifecycleStates[] targetStates) { var agent = new WaiterAgent <GetCertificateRequest, GetCertificateResponse>( request, request => client.GetCertificate(request), response => targetStates.Contains(response.Certificate.LifecycleState.Value), targetStates.Contains(LifecycleStates.Deleted) ); return(new Waiter <GetCertificateRequest, GetCertificateResponse>(config, agent)); }
public async Task GetCertificateExample() { long uln = 1234567890; string lastName = "Blogs"; string standard = "1"; GetCertificateRequest certificateToGet = new GetCertificateRequest { Uln = uln, FamilyName = lastName, Standard = standard, }; if (certificateToGet.IsValid(out _)) { // NOTE: The External API performs validation, however it is a good idea to check beforehand await _CertificateApiClient.GetCertificate(certificateToGet); } }
public async Task GetCertificate() { // arrange long uln = 1234567890; string lastname = "Bloggs"; string standard = "1"; string certificateReference = "123456790"; var certificateData = Builder <CertificateData> .CreateNew().With(cd => cd.CertificateReference = certificateReference) .With(cd => cd.Standard = Builder <Standard> .CreateNew().With(s => s.StandardCode = 1).Build()) .With(cd => cd.Learner = Builder <Learner> .CreateNew().Build()) .With(cd => cd.LearningDetails = Builder <LearningDetails> .CreateNew().Build()) .With(cd => cd.PostalContact = Builder <PostalContact> .CreateNew().Build()) .Build(); var status = new Status { CurrentStatus = "Submitted" }; var created = new Created { CreatedAt = DateTime.UtcNow.AddHours(-1), CreatedBy = "Test" }; var submitted = new Submitted { SubmittedAt = DateTime.UtcNow, SubmittedBy = "Test" }; var expectedResponse = new Certificate { CertificateData = certificateData, Status = status, Created = created, Submitted = submitted }; _MockHttp.When(HttpMethod.Get, $"{apiBaseAddress}/api/v1/certificate/{uln}/{lastname}/{standard}") .Respond(HttpStatusCode.OK, "application/json", JsonConvert.SerializeObject(expectedResponse)); // act var request = new GetCertificateRequest { Uln = uln, FamilyName = lastname, Standard = standard }; var actual = await _ApiClient.GetCertificate(request); // assert Assert.That(actual.Error, Is.Null); Assert.That(actual.Certificate, Is.Not.Null); }
private void HandleOutput(GetCertificateRequest request) { var waiterConfig = new WaiterConfiguration { MaxAttempts = MaxWaitAttempts, GetNextDelayInSeconds = (_) => WaitIntervalSeconds }; switch (ParameterSetName) { case LifecycleStateParamSet: response = client.Waiters.ForCertificate(request, waiterConfig, WaitForLifecycleState).Execute(); break; case Default: response = client.GetCertificate(request).GetAwaiter().GetResult(); break; } WriteOutput(response, response.Certificate); }
public async Task GetCertificate_CertificateNotYetCreated() { // arrange long uln = 1234567890; string lastname = "Bloggs"; string standard = "4321"; _MockHttp.When(HttpMethod.Get, $"{apiBaseAddress}/api/v1/certificate/{uln}/{lastname}/{standard}") .Respond(HttpStatusCode.NoContent, "application/json", string.Empty); // act var request = new GetCertificateRequest { Uln = uln, FamilyName = lastname, Standard = standard }; var actual = await _ApiClient.GetCertificate(request); // assert Assert.That(actual.Error, Is.Null); Assert.That(actual.Certificate, Is.Null); }
protected override void ProcessRecord() { base.ProcessRecord(); GetCertificateRequest request; try { request = new GetCertificateRequest { CertificateId = CertificateId, OpcRequestId = OpcRequestId }; HandleOutput(request); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public async Task <GetCertificateResponse> GetCertificate(GetCertificateRequest request) { var response = new GetCertificateResponse { Uln = request.Uln, FamilyName = request.FamilyName, Standard = request.Standard }; using (var apiResponse = await _httpClient.GetAsync($"api/v1/certificate/{request.Uln}/{request.FamilyName}/{request.Standard}")) { if (apiResponse.IsSuccessStatusCode) { response.Certificate = await apiResponse.Content.ReadAsAsync <Certificate>(); } else { response.Error = await apiResponse.Content.ReadAsAsync <ApiResponse>(); } } return(response); }
/// <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 <GetCertificateRequest, GetCertificateResponse> ForCertificate(GetCertificateRequest request, params LifecycleStates[] targetStates) { return(this.ForCertificate(request, WaiterConfiguration.DefaultWaiterConfiguration, targetStates)); }
/// <summary> /// Retrieves a certificate specified by an ARN and its certificate chain . The chain /// is an ordered list of certificates that contains the end entity certificate, intermediate /// certificates of subordinate CAs, and the root certificate in that order. The certificate /// and certificate chain are base64 encoded. If you want to decode the certificate to /// see the individual fields, you can use OpenSSL. /// </summary> /// <param name="certificateArn">String that contains a certificate ARN in the following format: <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code> For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a>.</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 GetCertificate service method, as returned by CertificateManager.</returns> /// <exception cref="Amazon.CertificateManager.Model.InvalidArnException"> /// The requested Amazon Resource Name (ARN) does not refer to an existing resource. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.RequestInProgressException"> /// The certificate request is in process and the certificate in your account has not /// yet been issued. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceNotFoundException"> /// The specified certificate cannot be found in the caller's account or the caller's /// account cannot be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/GetCertificate">REST API Reference for GetCertificate Operation</seealso> public virtual Task<GetCertificateResponse> GetCertificateAsync(string certificateArn, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new GetCertificateRequest(); request.CertificateArn = certificateArn; return GetCertificateAsync(request, cancellationToken); }