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

[Ready to MERGE] Swagger for Tenant Properties API #5038

Merged
merged 13 commits into from
Feb 22, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,47 @@
}
}
},
"/providers/Microsoft.Billing/discoverTenants?billingProfileId={billingProfileId}": {
Copy link
Contributor

Choose a reason for hiding this comment

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

As billingProfileId is mandatory, this is likely better served by a POST action request where the billingProfileId is passed in the request body. See this for an example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This API is designed for Power BI custom connector to achieve multi-tenancy. This design is approved by connector Team. It is a request flow which brings Tenant Id for a specified billingProfileId input. API is doing a tenant discovery and that's why it is named as "DiscoverTenant". I hope this clarifies your question.

Copy link
Contributor

Choose a reason for hiding this comment

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

This URL is not compliant with the Resource Provider Contract. It behaves as an action (POST) but is expressed as if it were a collection enumeration. To make this compliant with the RPC, you can model this as a POST/action, or this could be expressed as a normal collection enumeration:
`/providers/Microsoft.Billing/billingProfiles/{billingProfileId}/tenants/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes in swagger are committed to making the URL compliant with the Resource Provider Contract. The new URL is
'/providers/Microsoft.Billing/billingProfiles/{billingProfileId}/discoverTenants'

I am keeping the name discoverTenants as the sole purpose of this API is to discover the Tenants only. As all the review comments are implemented can you please mark this approve.

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you for these changes. This path is syntactically correct. The resource type name in this case would be "discoverTenants" which is a bit odd, as verbs are atypical in a resource type name. I would prefer it to be named with a noun pattern for consistency. discoveredTenants would be substantially preferable in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have done changes in resource type name from "discoverTenants" to "tenants" now.

"get": {
"tags": [
"discoverTenants"
],
"x-ms-examples": {
"TenantPropertiesGet": {
"$ref": "./examples/TenantPropertiesGet.json"
}
},
"operationId": "TenantProperties_Get",
"description": "Gets a Tenant Properties.",
"parameters": [
{
"name": "billingProfileId",
"in": "path",
"description": "Billing Profile Id.",
"required": true,
"type": "string"
},
{
"$ref": "#/parameters/apiVersionParameter"
}
],
"responses": {
"200": {
"description": "OK. The request has succeeded.",
"schema": {
"$ref": "#/definitions/TenantProperties"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},

"/subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices": {
"get": {
"tags": [
Expand Down Expand Up @@ -402,7 +443,7 @@
"$ref": "#/definitions/EnrollmentAccountProperties"
}
}
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Trim?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 looks like you replaced the next line indentation with a tab though 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see any tab in notepadd ++. Can you please approve it else it won't get published as ARM api.

"EnrollmentAccountListResult": {
"description": "Result of listing enrollment accounts.",
"properties": {
Expand Down Expand Up @@ -431,6 +472,26 @@
}
}
},
"TenantProperties": {
"description": "A Tenant properties Resource",
"properties": {
"billingProfileName": {
"description": "The Billing Profile name.",
"type": "string",
"readOnly": true
},
"billingAccountId": {
"description": "The Billing AccountId.",
"type": "string",
"readOnly": true
},
"tenantId": {
"description": "The TenantId.",
"type": "string",
"readOnly": true
}
}
},
"BillingPeriod": {
"description": "A billing period resource.",
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"parameters": {
"api-version": "2018-03-01-preview",
"billingProfileId": "f47d2fec-3db5-4758-8717-4ff7b1641c13"
},
"responses": {
"200": {
"body": {
"BillingProfileName": "PayByCheck01",
"BillingAccountId": "9984934b-0494-53de-0fcd-83828e47dbc6",
"TenantId": "251d3d06-c6e0-487b-bd5e-5c2e4c23d51a"
}
}
}
}