/// <summary> /// Gets a list of listings from Oracle Cloud Infrastructure Marketplace by searching keywords and /// filtering according to listing attributes. /// <br/> /// If you plan to launch an instance from an image listing, you must first subscribe to the listing. When /// you launch the instance, you also need to provide the image ID of the listing resource version that you want. /// <br/> /// Subscribing to the listing requires you to first get a signature from the terms of use agreement for the /// listing resource version. To get the signature, issue a [GetAppCatalogListingAgreements](https://docs.cloud.oracle.com/en-us/iaas/api/#/en/iaas/latest/AppCatalogListingResourceVersionAgreements/GetAppCatalogListingAgreements) API call. /// The [AppCatalogListingResourceVersionAgreements](https://docs.cloud.oracle.com/en-us/iaas/api/#/en/iaas/latest/AppCatalogListingResourceVersionAgreements) object, including /// its signature, is returned in the response. With the signature for the terms of use agreement for the desired /// listing resource version, create a subscription by issuing a /// [CreateAppCatalogSubscription](https://docs.cloud.oracle.com/en-us/iaas/api/#/en/iaas/latest/AppCatalogSubscription/CreateAppCatalogSubscription) API call. /// <br/> /// To get the image ID to launch an instance, issue a [GetAppCatalogListingResourceVersion](https://docs.cloud.oracle.com/en-us/iaas/api/#/en/iaas/latest/AppCatalogListingResourceVersion/GetAppCatalogListingResourceVersion) API call. /// Lastly, to launch the instance, use the image ID of the listing resource version to issue a [LaunchInstance](https://docs.cloud.oracle.com/en-us/iaas/api/#/en/iaas/latest/Instance/LaunchInstance) API call. /// /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/marketplace/ListListings.cs.html">here</a> to see an example of how to use ListListings API.</example> public async Task <ListListingsResponse> ListListings(ListListingsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called listListings"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/listings".Trim('/'))); HttpMethod method = new HttpMethod("GET"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false); } else { responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false); } this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage); return(Converter.FromHttpResponseMessage <ListListingsResponse>(responseMessage)); } catch (Exception e) { logger.Error($"ListListings failed with error: {e.Message}"); throw; } }
/// <summary> /// Creates a new enumerable which will iterate over the responses received from the ListListings operation. This enumerable /// will fetch more data from the server as needed. /// </summary> /// <param name="request">The request object containing the details to send</param> /// <param name="retryConfiguration">The configuration for retrying, may be null</param> /// <param name="cancellationToken">The cancellation token object</param> /// <returns>The enumerator, which supports a simple iteration over a collection of a specified type</returns> public IEnumerable <ListListingsResponse> ListListingsResponseEnumerator(ListListingsRequest request, Common.Retry.RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { return(new Common.Utils.ResponseEnumerable <ListListingsRequest, ListListingsResponse>( response => response.OpcNextPage, input => { if (!string.IsNullOrEmpty(input)) { request.Page = input; } return request; }, request => client.ListListings(request, retryConfiguration, cancellationToken) )); }
protected override void ProcessRecord() { base.ProcessRecord(); ListListingsRequest request; try { request = new ListListingsRequest { Name = Name, ListingId = ListingId, ImageId = ImageId, PublisherId = PublisherId, PackageType = PackageType, OpcRequestId = OpcRequestId, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, Category = Category, Pricing = Pricing, IsFeatured = IsFeatured, ListingTypes = ListingTypes, OperatingSystems = OperatingSystems, CompartmentId = CompartmentId }; IEnumerable <ListListingsResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, true); } if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null) { WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources."); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
protected override void ProcessRecord() { base.ProcessRecord(); ListListingsRequest request; try { request = new ListListingsRequest { Name = Name, ListingId = ListingId, PublisherId = PublisherId, PackageType = PackageType, OpcRequestId = OpcRequestId, Limit = Limit, Page = Page, SortBy = SortBy, SortOrder = SortOrder, Category = Category, Pricing = Pricing, IsFeatured = IsFeatured, CompartmentId = CompartmentId }; IEnumerable <ListListingsResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.Items, true); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }