示例#1
0
        public object GetListData()
        {
            var temp   = new GetListingRequest();
            var result = temp.RunRequest();

            return(result);
        }
示例#2
0
        /// <summary>
        /// Gets detailed information about a listing, including the listing&#39;s name, version, description, and
        /// resources.
        /// &lt;br/&gt;
        /// 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.
        /// &lt;br/&gt;
        /// 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.
        /// &lt;br/&gt;
        /// 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/GetListing.cs.html">here</a> to see an example of how to use GetListing API.</example>
        public async Task <GetListingResponse> GetListing(GetListingRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called getListing");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/listings/{listingId}".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 <GetListingResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"GetListing failed with error: {e.Message}");
                throw;
            }
        }
        public object GetListData([FromUri] GetListingRequest req)
        {
            req.UserId = User.Identity.GetUserId();
            var result = req.RunRequest(req);

            return(result);
        }
示例#4
0
        public object GetListData([FromUri] GetListingRequest temp)
        {
            //var temp = new GetListingRequest();
            if (!User.IsInRole(Roles.Admin) && !User.IsInRole(Roles.SuperAdmin))
            {
                temp.UserId = User.Identity.GetUserId();
            }

            var result = temp.RunRequest(temp);

            return(result);
        }
示例#5
0
        public object GetListData()
        {
            var result = new object();

            if (User.IsInRole(Roles.Admin))
            {
                var temp = new GetListingRequest();
                result = temp.RunRequest();
            }
            if (User.IsInRole(Roles.Inventory_Supplier))
            {
                var temp = new GetListingRequest();
                result = temp.RunRequest();
            }
            return(result);
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetListingRequest request;

            try
            {
                request = new GetListingRequest
                {
                    ListingId     = ListingId,
                    OpcRequestId  = OpcRequestId,
                    CompartmentId = CompartmentId
                };

                response = client.GetListing(request).GetAwaiter().GetResult();
                WriteOutput(response, response.Listing);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }