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

[Media Services] API doesn't return tags element when none exist #5249

Closed
tombuildsstuff opened this issue Feb 22, 2019 · 5 comments
Closed
Assignees
Labels
Media Services Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@tombuildsstuff
Copy link
Contributor

👋

We're using the Media Services API version v25.1.0 via the Azure SDK for Go in this package:

"github.com/Azure/azure-sdk-for-go/services/mediaservices/mgmt/2018-07-01/media"

We've noticed when provisioning a Media Services Account that if one or more Tags are provided, they're returned in the response; however if an empty Map is provided then the tags block is omitted from the API response.

For example, for the following API Request:

:authority: management.azure.com
:method: PUT
:path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174436542609/providers/Microsoft.Media/mediaservices/acctestmsafp4ez?api-version=2018-07-01
:scheme: https
content-type: application/json; charset=utf-8
user-agent: Go/go1.11.5 (amd64-darwin) go-autorest/v11.4.0 Azure-SDK-For-Go/v25.1.0 media/2018-07-01 Terraform/0.11.9 terraform-provider-azurerm/dev
authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
content-length: 257
accept-encoding: gzip

{
	"location": "westeurope",
	"properties": {
		"storageAccounts": [{
			"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174436542609/providers/Microsoft.Storage/storageAccounts/acctestsa1fp4ez",
			"type": "Primary"
		}]
	},
	"tags": {
		"Hello": "World"
	}
}

gives the following API response:

{
	"name": "acctestmsafp4ez",
	"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174436542609/providers/Microsoft.Media/mediaservices/acctestmsafp4ez",
	"type": "Microsoft.Media/mediaservices",
	"location": "West Europe",
	"tags": {
		"Hello": "World"
	},
	"properties": {
		"mediaServiceId": "5d4efe99-acd1-4705-b541-67034cce8c21",
		"storageAccounts": [{
			"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174436542609/providers/Microsoft.Storage/storageAccounts/acctestsa1fp4ez",
			"type": "Primary"
		}]
	}
}

However when no tags are provided in the Request:

:authority: management.azure.com
:method: PUT
:path: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174721721594/providers/Microsoft.Media/mediaservices/acctestmsarfshu?api-version=2018-07-01
:scheme: https
content-type: application/json; charset=utf-8
user-agent: Go/go1.11.5 (amd64-darwin) go-autorest/v11.4.0 Azure-SDK-For-Go/v25.1.0 media/2018-07-01 Terraform/0.11.9 terraform-provider-azurerm/dev
authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
content-length: 242
accept-encoding: gzip

{
	"location": "westeurope",
	"properties": {
		"storageAccounts": [{
			"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174721721594/providers/Microsoft.Storage/storageAccounts/acctestsa1rfshu",
			"type": "Primary"
		}]
	},
	"tags": {}
}

The tags block is omitted from the API response:

{
	"name": "acctestmsarfshu",
	"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174721721594/providers/Microsoft.Media/mediaservices/acctestmsarfshu",
	"type": "Microsoft.Media/mediaservices",
	"location": "West Europe",
	"tags": {

	},
	"properties": {
		"mediaServiceId": "cb3cc364-9571-4f1a-b05c-31429ac41d60",
		"storageAccounts": [{
			"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/190222174721721594/providers/Microsoft.Storage/storageAccounts/acctestsa1rfshu",
			"type": "Primary"
		}]
	}
}

Would it be possible to fix this API to return an empty Tags block when no tags are set?

FYI I've also raised a bug in the Azure SDK for Go where the mediaServiceId value isn't parsed out correctly - however this looks to be a Service issue rather than an SDK issue.

Thanks!

@salameer
Copy link
Member

Hi @quintinb can you kindly look into this reported issue?

@akucer
Copy link

akucer commented Jul 10, 2019

Azure Media Services will omit properties that are not required if they have the default value. As Tags are not a required property, when an empty Tag block is set it is omitted in the API response. We do not plan on changing this behavior.

@akucer akucer closed this as completed Jul 10, 2019
@akucer
Copy link

akucer commented Jul 10, 2019

Closing

@tombuildsstuff
Copy link
Contributor Author

@akucer this is different to the behaviour of every other Azure API, which returns the value of fields in all cases (such as in this one when there's no elements) - which I believe is part of the ARM Specification - so I'd suggest this might be worth re-considering?

@tombuildsstuff
Copy link
Contributor Author

ping @akucer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Media Services Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

5 participants