Skip to content

Commit

Permalink
Cosmos DB - Adding APIs for Role Definition and Role Assignment (#10493)
Browse files Browse the repository at this point in the history
* WOrk on Role Definition

* Finish json initial

* added examples

* added missing comma

* changes based on linter

* try removing filter from paht?

* spelled description wrong :(

* more fixes

* more  changes for exmaple issesu

* hopefully fix

* minor changes and delete old files

* changes based on warnings

* chnage to invalidroledefinition

* change delete to 202

* change put to 202

* change default error response

* fix response code example

* fix errors

* RoleDefinitionType enum

* changes based on comments

* trying different errorresponse

* more changes based on comments + add DefaultErrorResponse

* minor typo fixes

* some minor changes

* remove notdataactions and change databaseAccountName to accountName

* new changes based on comments

* changes to comments and DefaultErrorResponse

* change to errorResponse

* change to delete responses

* changes to descriptions

* change description

* add back notDataActions

* add 'Sql' to operationIds
  • Loading branch information
kristynhamasaki authored Sep 24, 2020
1 parent 4583ff4 commit 2a4dc28
Show file tree
Hide file tree
Showing 11 changed files with 857 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4215,7 +4215,7 @@
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponseUpdatedFormat"
"$ref": "#/definitions/DefaultErrorResponse"
}
}
},
Expand Down Expand Up @@ -4251,7 +4251,7 @@
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponseUpdatedFormat"
"$ref": "#/definitions/DefaultErrorResponse"
}
}
},
Expand Down Expand Up @@ -4293,7 +4293,7 @@
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponseUpdatedFormat"
"$ref": "#/definitions/DefaultErrorResponse"
}
}
}
Expand Down Expand Up @@ -4483,11 +4483,11 @@
},
"description": "Error Response."
},
"ErrorResponseUpdatedFormat": {
"DefaultErrorResponse": {
"description": "An error response from the service.",
"properties": {
"error": {
"$ref": "../../../../../common-types/resource-management/v1/types.json#/definitions/ErrorResponse"
"$ref": "#/definitions/ErrorResponse"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"parameters": {
"roleAssignmentId": "myRoleAssignmentId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview",
"createUpdateSqlRoleAssignmentParameters": {
"properties": {
"roleDefinitionId": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"scope": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases",
"principalId": "myPrincipalId"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId",
"name": "myRoleAssignmentId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
"properties": {
"roleDefinitionId": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"scope": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases",
"principalId": "myPrincipalId"
}
}
},
"202": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parameters": {
"roleAssignmentId": "myRoleAssignmentId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parameters": {
"roleAssignmentId": "myRoleAssignmentId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId",
"name": "myRoleAssignmentId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
"properties": {
"roleDefinitionId": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"scope": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases",
"principalId": "myPrincipalId"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"parameters": {
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleAssignments/myRoleAssignmentId",
"name": "myRoleAssignmentId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleAssignments",
"properties": {
"roleDefinitionId": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"scope": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases",
"principalId": "myPrincipalId"
}
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"parameters": {
"roleDefinitionId": "myRoleDefinitionId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview",
"createUpdateSqlRoleDefinitionParameters": {
"properties": {
"roleName": "myRoleName",
"type": "CustomRole",
"assignableScopes": [
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales",
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases"
],
"permissions": [
{
"dataActions": [
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create",
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"
],
"notDataActions": []
}
]
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"name": "myRoleDefinitionId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions",
"properties": {
"roleName": "myRoleName",
"type": "CustomRole",
"assignableScopes": [
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales",
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases"
],
"permissions": [
{
"dataActions": [
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create",
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"
]
}
]
}
}
},
"202": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parameters": {
"roleDefinitionId": "myRoleDefinitionId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {},
"202": {},
"204": {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"roleDefinitionId": "myRoleDefinitionId",
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"name": "myRoleDefinitionId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions",
"properties": {
"roleName": "myRoleName",
"type": "CustomRole",
"assignableScopes": [
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales",
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases"
],
"permissions": [
{
"dataActions": [
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create",
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"
],
"notDataActions": []
}
]
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"parameters": {
"subscriptionId": "mySubscriptionId",
"resourceGroupName": "myResourceGroupName",
"accountName": "myAccountName",
"api-version": "2020-06-01-preview"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId",
"name": "myRoleDefinitionId",
"type": "Microsoft.DocumentDB/databaseAccounts/sqlRoleDefinitions",
"properties": {
"roleName": "myRoleName",
"type": "CustomRole",
"assignableScopes": [
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales",
"/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases"
],
"permissions": [
{
"dataActions": [
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/create",
"Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"
],
"notDataActions": []
}
]
}
}
]
}
}
}
}
Loading

0 comments on commit 2a4dc28

Please sign in to comment.