protected override void ProcessRecord()
        {
            base.ProcessRecord();
            GetAppCatalogListingResourceVersionRequest request;

            try
            {
                request = new GetAppCatalogListingResourceVersionRequest
                {
                    ListingId       = ListingId,
                    ResourceVersion = ResourceVersion
                };

                response = client.GetAppCatalogListingResourceVersion(request).GetAwaiter().GetResult();
                WriteOutput(response, response.AppCatalogListingResourceVersion);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the specified listing resource version.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public GetAppCatalogListingResourceVersionResponse GetAppCatalogListingResourceVersion(GetAppCatalogListingResourceVersionRequest request)
        {
            var uri = new Uri($"{GetEndPoint(CoreServices.AppCatalogListings, this.Region)}/{request.ListingId}/resourceVersions/{request.ResourceVersion}");

            using (var webResponse = this.RestClient.Get(uri))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = reader.ReadToEnd();

                        return(new GetAppCatalogListingResourceVersionResponse()
                        {
                            AppCatalogListingResourceVersion = this.JsonSerializer.Deserialize <AppCatalogListingResourceVersion>(response),
                            ETag = webResponse.Headers.Get("etag"),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id")
                        });
                    }
        }