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

Adding AddBillingRoleAssignment API in 2020-05-01 version #11023

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3460,6 +3460,150 @@
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createBillingRoleAssignment [](start = 71, length = 27)

You are modifying an existing stable API version. As per https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#versioning, this is not allowed and requires a version bump.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added new apis to same version earlier in past 15 days: #10585

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think I will allow it given that we've created an expectation that this is ok.


In reply to: 499105356 [](ancestors = 499105356)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! @majastrz

"post": {
"tags": [
"BillingRoleAssignments"
],
"operationId": "BillingRoleAssignments_AddByBillingAccount",
"description": "Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement.",
"x-ms-examples": {
"AddRoleAssignmentToBillingAccount": {
"$ref": "./examples/AddRoleAssignmentToBillingAccount.json"
}
},
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountNameParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BillingRoleAssignmentRequestProperties"
},
"description": "Request parameters that are provided to the create billing role assignment operation."
}
],
"responses": {
"201": {
"description": "Role assignment is successfully created",
"schema": {
"$ref": "#/definitions/BillingRoleAssignment"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createBillingRoleAssignment [](start = 145, length = 27)

Why are we modeling this as a POST instead of a proper resource with PUT and GET and list?

Copy link
Contributor Author

@asarkar84 asarkar84 Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The swagger already has the GET and List apis. We are currently adding an action to add the role assignments.
We have introduced this as POST since we rely on an external source to store the role assignments and they do not support PUT (they do not accept any user defined values as of now.) We tried some workarounds at our end to store it locally but it was not working with concurrent updates etc.

Copy link
Contributor Author

@asarkar84 asarkar84 Oct 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the reason we did not publish this api along with other APIs. Our older version of API also has POST.
We were able to introduce PUT apis for other entities but this one could not be done. We tried our best.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

"post": {
"tags": [
"BillingRoleAssignments"
],
"operationId": "BillingRoleAssignments_AddByInvoiceSection",
"description": "Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement.",
"x-ms-examples": {
"AddRoleAssignmentToInvoiceSection": {
"$ref": "./examples/AddRoleAssignmentToInvoiceSection.json"
}
},
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountNameParameter"
},
{
"$ref": "#/parameters/billingProfileNameParameter"
},
{
"$ref": "#/parameters/invoiceSectionNameParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BillingRoleAssignmentRequestProperties"
},
"description": "Request parameters that are provided to the create billing role assignment operation."
}
],
"responses": {
"201": {
"description": "Role assignment is successfully created",
"schema": {
"$ref": "#/definitions/BillingRoleAssignment"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment": {
"post": {
"tags": [
"BillingRoleAssignments"
],
"operationId": "BillingRoleAssignments_AddByBillingProfile",
"description": "Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement.",
"x-ms-examples": {
"AddRoleAssignmentToBillingProfile": {
"$ref": "./examples/AddRoleAssignmentToBillingProfile.json"
}
},
"parameters": [
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"$ref": "#/parameters/billingAccountNameParameter"
},
{
"$ref": "#/parameters/billingProfileNameParameter"
},
{
"name": "parameters",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BillingRoleAssignmentRequestProperties"
},
"description": "Request parameters that are provided to the create billing role assignment operation."
}
],
"responses": {
"201": {
"description": "Role assignment is successfully created",
"schema": {
"$ref": "#/definitions/BillingRoleAssignment"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements": {
"get": {
"tags": [
Expand Down Expand Up @@ -6026,6 +6170,19 @@
}
}
},
"BillingRoleAssignmentRequestProperties": {
"description": "The request parameters to add the role assignment on a scope",
"properties": {
"principalId": {
"description": "The user's principal id that the role gets assigned to",
"type": "string"
},
"roleDefinitionId": {
"description": "The role definition id",
"type": "string"
}
}
},
"BillingRoleDefinitionListResult": {
"description": "The list of role definitions.",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"parameters": {
"api-version": "2020-05-01",
"billingAccountName": "{billingAccountName}",
"parameters": {
"principalId": "00000000-0000-0000-0000-000000000000",
"roleDefinitionId": "{roleDefinitionId}"
}
},
"responses": {
"201": {
"body": {
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9",
"name": "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9",
"properties": {
"createdOn": "2018-06-21T21:34:12.2363515+00:00",
"createdByPrincipalTenantId": "7ca289b9-c32d-4f01-8566-7ff93261d76f",
"createdByPrincipalId": "10000000-aaaa-bbbb-cccc-3fd5ff9d6aa1",
"principalId": "00000000-0000-0000-0000-000000000000",
"scope": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}",
"principalTenantId": "10000000-aaaa-bbbb-cccc-2d7cd011db47",
"roleDefinitionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000002"
},
"type": "Microsoft.Billing/billingAccounts/billingRoleAssignments"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parameters": {
"api-version": "2020-05-01",
"billingAccountName": "{billingAccountName}",
"billingProfileName": "{billingProfileName}",
"parameters": {
"principalId": "00000000-0000-0000-0000-000000000000",
"roleDefinitionId": "{roleDefinitionId}"
}
},
"responses": {
"201": {
"body": {
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47",
"name": "10000000-aaaa-bbbb-cccc-100000000000_b1839933-b3ac-42ca-8112-d29c43f3ab47",
"properties": {
"createdOn": "2018-06-21T21:58:19.9073876+00:00",
"scope": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}",
"createdByPrincipalTenantId": "7ca289b9-c32d-4f01-8566-7ff93261d76f",
"createdByPrincipalId": "10000000-aaaa-bbbb-cccc-3fd5ff9d6aa1",
"principalId": "00000000-0000-0000-0000-000000000000",
"principalTenantId": "10000000-aaaa-bbbb-cccc-2d7cd011db47",
"roleDefinitionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000002"
},
"type": "Microsoft.Billing/billingAccounts/billingProfiles/billingRoleAssignments"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"parameters": {
"api-version": "2020-05-01",
"billingAccountName": "{billingAccountName}",
"billingProfileName": "{billingProfileName}",
"invoiceSectionName": "{invoiceSectionName}",
"parameters": {
"principalId": "00000000-0000-0000-0000-000000000000",
"roleDefinitionId": "{roleDefinitionId}"
}
},
"responses": {
"201": {
"body": {
"id": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9",
"name": "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9",
"properties": {
"createdOn": "2018-06-21T21:34:12.2363515+00:00",
"scope": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}",
"createdByPrincipalTenantId": "7ca289b9-c32d-4f01-8566-7ff93261d76f",
"createdByPrincipalId": "10000000-aaaa-bbbb-cccc-3fd5ff9d6aa1",
"principalId": "00000000-0000-0000-0000-000000000000",
"principalTenantId": "10000000-aaaa-bbbb-cccc-2d7cd011db47",
"roleDefinitionId": "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/50000000-aaaa-bbbb-cccc-100000000002"
},
"type": "Microsoft.Billing/billingAccounts/billingProfiles/invoiceSections/billingRoleAssignments"
}
}
}
}