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

Incorrect behavior of Create method of armmarketplaceordering.MarketplaceAgreementsClient #21292

Open
unmarshall opened this issue Jul 31, 2023 · 1 comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Marketplace Ordering Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Service This issue points to a problem in the service.

Comments

@unmarshall
Copy link

unmarshall commented Jul 31, 2023

Bug Report

Package dependencies and versions used:

github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0-beta.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0-beta.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.1.0-beta.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/marketplaceordering/armmarketplaceordering v1.2.0-beta.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v3 v3.1.0-beta.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.8.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0-beta.2

I am currently using armmarketplaceorder.MarketplaceAgreementsClient to create AgreementTerms for a combination of OfferType, PublisherID, PlanID, OfferID and AgreementTerms and i have observed the following:

Observation-1
All other clients have either CreateOrUpdate or BeginCreateOrUpdate methods which clearly says that it will create it the resource does not exist but it will update if the resource exists. In MarketplaceAgreementsClient there is a single Create method. Semantically a create only creates and does not update, however if the resource exists then it does not return any error. Behind the scene it uses PUT HTTP verb which is used to update a resource. This explains why it does not fail. So either this method should be renamed to CreateOrUpdate just like the rest of clients or a POST request should be used to create.

Observation-2
Assume that there is already an agreement for {Publisher: bingo, Offer: my-os, Plan: greatest}, now make a Create call and change the Plan to greatest1111 or anything other than greatest. You will see that the request succeeds. Since it makes a PUT request one would assume that the Plan would get updated. However that does not get updated. Try and get the resource again and you will see that Plan is intact and has not changed. The API should clearly define what can be updated and what cannot be updated.

Observation-3
Get the agreement terms, change resp.AgreementTerms.Properties.Publisher to bingo1 (original was bingo). Use the Create call to update it. The update succeeds but when you get the agreement terms again, then resp.AgreementTerms.Properties.Publisher is unchanged.

Observation-4
Get the current agreement terms and change the signature. Call Create with an agreement that contains the changed signature. The update is allowed and is also reflected when you get the agreement terms again.

So till now it seems that Create can be used to update Accepted and Signature. I have not tested all the fields that are part of AgreementTerms apart from what has been already mentioned in the above observations. Nothing is mentioned as part of the API documentation w.r.t what can be updated and what cannot be. The responses returned by the API also does not help as they accept the changes for some and never actually updated the resource, whereas only a subset of field updates get reflected.

In its current form this API is quite hard to understand and use.

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jul 31, 2023
@jhendrixMSFT jhendrixMSFT added Marketplace Ordering Mgmt This issue is related to a management-plane library. Service This issue points to a problem in the service. Service Attention Workflow: This issue is responsible by Azure service team. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Jul 31, 2023
@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jul 31, 2023
@github-actions
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @prbansa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Marketplace Ordering Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Service This issue points to a problem in the service.
Projects
None yet
Development

No branches or pull requests

2 participants