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 support for delegations on a subnet #3693

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
@@ -0,0 +1,165 @@
{
"swagger": "2.0",
"info": {
"title": "NetworkManagementClient",
"description": "The Microsoft Azure Network management API provides a RESTful set of web services that interact with Microsoft Azure Networks service to manage your network resources. The API has entities that capture the relationship between an end user and the Microsoft Azure Networks service.",
"version": "2018-08-01"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
"/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations": {
"get": {
"operationId": "AvailableDelegations_List",
"description": "Gets all of the available subnet delegations for this subscription in this region.",
"parameters": [
{
"name": "location",
"in": "path",
"required": true,
"type": "string",
"description": "The location of the subnet."
},
{
"$ref": "./network.json#/parameters/ApiVersionParameter"
},
{
"$ref": "./network.json#/parameters/SubscriptionIdParameter"
}
],
"responses": {
"200": {
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"description": "Request successful. Returns all of the possible delegations for a subnet in this subscription in the region.",
"schema": {
"$ref": "#/definitions/AvailableDelegationsResult"
}
}
},
"x-ms-examples": {
"Get available delegations": {
"$ref": "./examples/AvailableDelegationsSubscriptionGet.json"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations": {
"get": {
"operationId": "AvailableResourceGroupDelegations_List",
"description": "Gets all of the available subnet delegations for this resource group in this region.",
"parameters": [
{
"name": "location",
"in": "path",
"required": true,
"type": "string",
"description": "The location of the domain name."
},
{
"name": "resourceGroupName",
"in": "path",
"required": true,
"type": "string",
"description": "The name of the resource group."
},
{
"$ref": "./network.json#/parameters/SubscriptionIdParameter"
},
{
"$ref": "./network.json#/parameters/ApiVersionParameter"
}
],
"responses": {
"200": {
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"description": "Request successful. Returns all of the possible delegations for a subnet in this subscription in the region.",
"schema": {
"$ref": "#/definitions/AvailableDelegationsResult"
}
}
},
"x-ms-examples": {
"Get available delegations in the resource group": {
"$ref": "./examples/AvailableDelegationsResourceGroupGet.json"
}
},
"x-ms-pageable": {
"nextLinkName": "nextLink"
}
}
}
},
"definitions": {
"AvailableDelegationsResult": {
"properties": {
"value": {
"type": "array",
"items": {
"$ref": "#/definitions/AvailableDelegation"
},
"description": "An array of available delegations."
},
"nextLink": {
"type": "string",
"description": "The URL to get the next set of results."
}
},
"description": "An array of available delegations."
},
"AvailableDelegation": {
"properties": {
"name": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Couple of questions:

  1. Why?
  2. How?

Copy link
Contributor

Choose a reason for hiding this comment

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

Because if it IS a proxy resource then extending it from proxy resource is the CORRECT way.

Copy link
Contributor

@jianghaolu jianghaolu Aug 31, 2018

Choose a reason for hiding this comment

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

You may also extend from SubResource and get rid of the id property, that's okay too

Copy link
Member

Choose a reason for hiding this comment

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

We'll fix this and get back.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed

"type": "string",
"description": "The name of the AvailableDelegation resource."
},
"id": {
"type": "string",
"description": "A unique identifier of the AvailableDelegation resource."
},
"type": {
"type": "string",
"description": "Resource type."
},
"serviceName": {
"type": "string",
"description": "The name of the service and resource "
},
"actions": {
"type": "array",
"items": {
"type": "string"
},
"description": "Describes the actions permitted to the service upon delegation"
}
},
"description": "The serviceName of an AvailableDelegation indicates a possible delegation for a subnet."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"parameters" : {
"api-version": "2018-08-01",
"location": "regionName",
"subscriptionId" : "subId",
"resourceGroupName" : "rg1"
},
"responses" : {
"200" : {
"body" : {
"value": [
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
{
"name": "Microsoft.Provider.resourceType",
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"id": "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/availableDelegations/Microsoft.Provider.resourceType",
"type": "Microsoft.Network/availableDelegations",
"serviceName": "Microsoft.Provider/resourceType",
"actions": [
"Microsoft.Network/resource/action"
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parameters" : {
"api-version": "2018-08-01",
"location": "regionName",
"subscriptionId" : "subId"
},
"responses" : {
"200" : {
"body" : {
"value": [
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
{
"name": "Microsoft.Provider.resourceType",
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"id": "/subscriptions/subId/providers/Microsoft.Network/availableDelegations/Microsoft.Provider.resourceType",
"type": "Microsoft.Network/availableDelegations",
"serviceName": "Microsoft.Provider/resourceType",
"actions": [
"Microsoft.Network/resource/action"
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"parameters": {
"subnetName": "subnet1",
"virtualNetworkName": "vnetname",
"resourceGroupName": "subnet-test",
"api-version": "2018-08-01",
"subscriptionId": "subId",
"subnetParameters": {
"properties": {
"addressPrefix": "10.0.0.0/16"
}
}
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1",
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.0.0/16",
"provisioningState": "Succeeded",
"delegations": [
{
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"name": "myDelegation",
"id": "/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1/delegations/myDelegation",
"properties": {
"provisioningState": "Succeeded",
Copy link
Contributor

Choose a reason for hiding this comment

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

According the spec you are returning a "Delegation" instead of an "AvailableDelegation" here. "Delegation"'s properties don't contain provisioningState and `actions': https://github.com/Azure/azure-rest-api-specs/pull/3693/files#diff-48ae68150e376ac636b1bc2e92b09b32R868.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the service is actually returning "AvailableDelegation"? Please double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AvailableDelegation and ServiceDelegation are two different resources on the backend

Copy link
Member

Choose a reason for hiding this comment

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

Jianghaolu - I do not see any problem here. Rupali is returning Delegations. Can you please confirm and explain more on what you are saying?

"serviceName": "Microsoft.Provider/resourceType",
"actions": []
},
"type": "Microsoft.Network/virtualNetworks/subnets/delegations"
}
],
"purpose": ""
},
"type": "Microsoft.Network/virtualNetworks/subnets"
}
},
"201": {
"body": {
"id": "/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1",
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.0.0/16",
"provisioningState": "Succeeded",
"delegations": [
{
"name": "myDelegation",
"id": "/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1/delegations/myDelegation",
"properties": {
"provisioningState": "Succeeded",
"serviceName": "Microsoft.Provider/resourceType",
"actions": []
},
"type": "Microsoft.Network/virtualNetworks/subnets/delegations"
}
],
"purpose": ""
},
"type": "Microsoft.Network/virtualNetworks/subnets"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"subnetName": "subnet1",
"virtualNetworkName": "vnetname",
"resourceGroupName": "subnet-test",
"api-version": "2018-08-01",
"subscriptionId": "subId"
},
"responses": {
"200": {
"body": {
"id": "/subscriptions/subId/resourceGroups/subnet-test/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/subnet1",
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.0.0/16",
"provisioningState": "Succeeded",
"delegations": [
{
"name": "myDelegation",
rupalivohra marked this conversation as resolved.
Show resolved Hide resolved
"id": "/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1/delegations/myDelegation",
"properties": {
"provisioningState": "Succeeded",
"serviceName": "Microsoft.Provider/resourceType",
"actions": []
},
"type": "Microsoft.Network/virtualNetworks/subnets/delegations"
}
],
"purpose": ""
},
"type": "Microsoft.Network/virtualNetworks/subnets"
}
}
}
}
Loading