Exemplo n.º 1
0
        public async Task <Response <CommunityGalleryImageData> > GetAsync(string subscriptionId, AzureLocation location, string publicGalleryName, string galleryImageName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(publicGalleryName, nameof(publicGalleryName));
            Argument.AssertNotNullOrEmpty(galleryImageName, nameof(galleryImageName));

            using var message = CreateGetRequest(subscriptionId, location, publicGalleryName, galleryImageName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                CommunityGalleryImageData value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = CommunityGalleryImageData.DeserializeCommunityGalleryImageData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Exemplo n.º 2
0
 internal CommunityGalleryImageResource(ArmClient client, CommunityGalleryImageData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }