Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shared Image Galleries] Exposing the regions field in the response #2855

Closed
tombuildsstuff opened this issue Sep 28, 2018 · 2 comments
Closed
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.

Comments

@tombuildsstuff
Copy link
Contributor

👋

We're using SDK v20.1.0 with the Shared Image Galleries from this package:

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute"

When creating a version of an image - it's possible to specify the regions in which this should be replicated to as a slice of strings:

version := compute.GalleryImageVersion{
		Location: utils.String(location),
		GalleryImageVersionProperties: &compute.GalleryImageVersionProperties{
			PublishingProfile: &compute.GalleryImageVersionPublishingProfile{
				ExcludeFromLatest: utils.Bool(excludeFromLatest),
				Regions:           []string{}{"example", "other"},
				Source: &compute.GalleryArtifactSource{
					ManagedImage: &compute.ManagedArtifact{
						ID: utils.String(managedImageId),
					},
				},
			},
		},
		Tags: expandTags(tags),
	}

However this field isn't directly exposed in the API response - instead being returned as targetRegions:

{
	"type": "Microsoft.Compute/galleries/images/versions",
	"location": "westcentralus",
	"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tomdev/providers/Microsoft.Compute/galleries/tomdevimagegallery/images/my-image/versions/0.0.1",
	"name": "0.0.1",
	"properties": {
		"publishingProfile": {
			"replicaCount": 1,
			"excludeFromLatest": false,
			"publishedDate": "2018-09-28T00:00:00+00:00",
			"targetRegions": [{
				"name": "West Central US",
				"regionalReplicaCount": 1
			}],
			"source": {
				"managedImage": {
					"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tomdev/providers/Microsoft.Compute/images/tharvey-image"
				}
			}
		},
		"provisioningState": "Succeeded",
		"storageProfile": {
			"osDiskImage": {
				"sizeInGB": 30,
				"hostCaching": "ReadWrite"
			}
		},
		"replicationStatus": {
			"aggregatedState": "Completed",
			"summary": [{
				"region": "westcentralus",
				"state": "Completed",
				"progress": 100
			}]
		}
	}
}

Whilst this targetRegions field is being returned - it's not available in the SDK response object (which instead references the regions field from the Create) - would it be possible to expose this field?

// GalleryImageVersionProperties describes the properties of a gallery image version.
type GalleryImageVersionProperties struct {
	PublishingProfile *GalleryImageVersionPublishingProfile `json:"publishingProfile,omitempty"`
	// ProvisioningState - The provisioning state, which only appears in the response. Possible values include: 'ProvisioningState2Creating', 'ProvisioningState2Updating', 'ProvisioningState2Failed', 'ProvisioningState2Succeeded', 'ProvisioningState2Deleting', 'ProvisioningState2Migrating'
	ProvisioningState ProvisioningState2                 `json:"provisioningState,omitempty"`
	StorageProfile    *GalleryImageVersionStorageProfile `json:"storageProfile,omitempty"`
	ReplicationStatus *ReplicationStatus                 `json:"replicationStatus,omitempty"`
}

// GalleryImageVersionPublishingProfile the publishing profile of a gallery image version.
type GalleryImageVersionPublishingProfile struct {
	// ScaleTier - The scale tier of the gallery image version. Valid values are 'S30' and 'S100'. Possible values include: 'S30', 'S100'
	ScaleTier ScaleTier `json:"scaleTier,omitempty"`
	// ExcludeFromLatest - The flag means that if it is set to true, people deploying VMs with 'latest' as version will not use this version.
	ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"`
	// PublishedDate - The time when the gallery image version is published.
	PublishedDate *date.Time `json:"publishedDate,omitempty"`
	// EndOfLifeDate - The end of life date of the gallery image version.
	EndOfLifeDate *date.Time `json:"endOfLifeDate,omitempty"`
	// Regions - The regions where the artifact is going to be published.
	Regions *[]string              `json:"regions,omitempty"`
	Source  *GalleryArtifactSource `json:"source,omitempty"`
}

In terms of a workaround - we can currently use the replicationStatus to get this information - presuming it returns all of the locations?

Would it be possible to expose this field?

Thanks!

@tombuildsstuff tombuildsstuff changed the title [Shared Image Galleries] Exposing the retions field in the response [Shared Image Galleries] Exposing the regions field in the response Sep 28, 2018
@jhendrixMSFT
Copy link
Member

@tombuildsstuff looks like this was recently fixed in the swagger.
https://github.com/Azure/azure-sdk-for-go/blob/master/services/compute/mgmt/2018-06-01/compute/models.go#L3226
The change is in v21.0.0, are you able to use that version?

@tombuildsstuff
Copy link
Contributor Author

@jhendrixMSFT good spot, we've upgraded and this looks good to us - thanks :)

@RickWinter RickWinter added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jul 12, 2021
azure-sdk pushed a commit that referenced this issue Mar 3, 2022
* Update existing comment from APIView bot
azure-sdk pushed a commit that referenced this issue Mar 4, 2022
* Update existing comment from APIView bot
azure-sdk pushed a commit that referenced this issue Mar 4, 2022
* Update existing comment from APIView bot
azure-sdk pushed a commit that referenced this issue Mar 5, 2022
* Update existing comment from APIView bot
azure-sdk pushed a commit that referenced this issue Mar 5, 2022
* Update existing comment from APIView bot
azure-sdk pushed a commit that referenced this issue Mar 5, 2022
* Update existing comment from APIView bot
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

No branches or pull requests

3 participants