public virtual Pageable <Certificate> List(CertificateListOptions certificateListOptions, CancellationToken cancellationToken = default) { Page <Certificate> FirstPageFunc(int?pageSizeHint) { var response = RestClient.List(certificateListOptions, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } Page <Certificate> NextPageFunc(string nextLink, int?pageSizeHint) { var response = RestClient.ListNextPage(nextLink, certificateListOptions, cancellationToken); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }
public virtual AsyncPageable <Certificate> ListAsync(CertificateListOptions certificateListOptions, CancellationToken cancellationToken = default) { async Task <Page <Certificate> > FirstPageFunc(int?pageSizeHint) { var response = await RestClient.ListAsync(certificateListOptions, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } async Task <Page <Certificate> > NextPageFunc(string nextLink, int?pageSizeHint) { var response = await RestClient.ListNextPageAsync(nextLink, certificateListOptions, cancellationToken).ConfigureAwait(false); return(Page.FromValues(response.Value.Value, response.Value.OdataNextLink, response.GetRawResponse())); } return(PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc)); }
internal HttpMessage CreateListRequest(CertificateListOptions certificateListOptions) { var message = pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.AppendRaw(batchUrl, false); uri.AppendPath("/certificates", false); if (certificateListOptions?.Filter != null) { uri.AppendQuery("$filter", certificateListOptions.Filter, true); } if (certificateListOptions?.Select != null) { uri.AppendQuery("$select", certificateListOptions.Select, true); } if (certificateListOptions?.MaxResults != null) { uri.AppendQuery("maxresults", certificateListOptions.MaxResults.Value, true); } if (certificateListOptions?.Timeout != null) { uri.AppendQuery("timeout", certificateListOptions.Timeout.Value, true); } uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; if (certificateListOptions?.ClientRequestId != null) { request.Headers.Add("client-request-id", certificateListOptions.ClientRequestId.Value); } if (certificateListOptions?.ReturnClientRequestId != null) { request.Headers.Add("return-client-request-id", certificateListOptions.ReturnClientRequestId.Value); } if (certificateListOptions?.OcpDate != null) { request.Headers.Add("ocp-date", certificateListOptions.OcpDate.Value, "R"); } return(message); }
/// <summary> /// Lists all of the Certificates that have been added to the specified /// Account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='certificateListOptions'> /// Additional parameters for the operation /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IPage <Certificate> > ListAsync(this ICertificateOperations operations, CertificateListOptions certificateListOptions = default(CertificateListOptions), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(certificateListOptions, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Lists all of the Certificates that have been added to the specified /// Account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='certificateListOptions'> /// Additional parameters for the operation /// </param> public static IPage <Certificate> List(this ICertificateOperations operations, CertificateListOptions certificateListOptions = default(CertificateListOptions)) { return(operations.ListAsync(certificateListOptions).GetAwaiter().GetResult()); }
/// <summary> /// Lists all of the certificates that have been added to the specified /// account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='certificateListOptions'> /// Additional parameters for the operation /// </param> public static Microsoft.Rest.Azure.IPage <Certificate> List(this ICertificateOperations operations, CertificateListOptions certificateListOptions = default(CertificateListOptions)) { return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ICertificateOperations)s).ListAsync(certificateListOptions), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
public async ValueTask <ResponseWithHeaders <CertificateListResult, ListHeaders> > ListAsync(CertificateListOptions certificateListOptions, CancellationToken cancellationToken = default) { using var scope = clientDiagnostics.CreateScope("CertificateClient.List"); scope.Start(); try { using var message = CreateListRequest(certificateListOptions); await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); var headers = new ListHeaders(message.Response); switch (message.Response.Status) { case 200: { CertificateListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = CertificateListResult.DeserializeCertificateListResult(document.RootElement); return(ResponseWithHeaders.FromValue(value, headers, message.Response)); }