diff --git a/.chronus/changes/private-endpoints-2025-7-3-22-36-31.md b/.chronus/changes/private-endpoints-2025-7-3-22-36-31.md new file mode 100644 index 0000000000..2965cda705 --- /dev/null +++ b/.chronus/changes/private-endpoints-2025-7-3-22-36-31.md @@ -0,0 +1,7 @@ +--- +changeKind: feature +packages: + - "@azure-tools/typespec-azure-resource-manager" +--- + +Add operations for Private Endpoints \ No newline at end of file diff --git a/.chronus/changes/typespec-azure-vscode-2025-4-27-15-18-2.md b/.chronus/changes/typespec-azure-vscode-2025-4-27-15-18-2.md deleted file mode 100644 index 3d26b01a0b..0000000000 --- a/.chronus/changes/typespec-azure-vscode-2025-4-27-15-18-2.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -changeKind: internal -packages: - - typespec-azure-vscode ---- - -Initialize the typespec-azure-vscode package diff --git a/packages/samples/specs/resource-manager/resource-types/private-endpoints/main.tsp b/packages/samples/specs/resource-manager/resource-types/private-endpoints/main.tsp new file mode 100644 index 0000000000..1fcbad8ad2 --- /dev/null +++ b/packages/samples/specs/resource-manager/resource-types/private-endpoints/main.tsp @@ -0,0 +1 @@ +import "./private-endpoints.tsp"; diff --git a/packages/samples/specs/resource-manager/resource-types/private-endpoints/private-endpoints.tsp b/packages/samples/specs/resource-manager/resource-types/private-endpoints/private-endpoints.tsp new file mode 100644 index 0000000000..d90f755aed --- /dev/null +++ b/packages/samples/specs/resource-manager/resource-types/private-endpoints/private-endpoints.tsp @@ -0,0 +1,149 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using Rest; +using Versioning; +using Azure.Core; +using Azure.ResourceManager; + +/** Contoso Resource Provider management API. */ +@armProviderNamespace +@service(#{ title: "ContosoProviderHubClient" }) +@versioned(Versions) +namespace Microsoft.ContosoProviderHub; + +/** Contoso API versions */ +enum Versions { + /** 2021-10-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + `2021-10-01-preview`, +} + +// For more information about the proxy vs tracked, +// see https://armwiki.azurewebsites.net/rp_onboarding/tracked_vs_proxy_resources.html?q=proxy%20resource +/** A ContosoProviderHub resource */ +model Employee is TrackedResource { + ...ResourceNameParameter; +} + +/** Employee properties */ +model EmployeeProperties { + /** Age of employee */ + age?: int32; + + /** City of employee */ + city?: string; + + /** Profile of employee */ + @encode("base64url") + profile?: bytes; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} + +/** The provisioning state of a resource. */ +@lroStatus +union ProvisioningState { + ResourceProvisioningState, + + /** The resource is being provisioned */ + Provisioning: "Provisioning", + + /** The resource is updating */ + Updating: "Updating", + + /** The resource is being deleted */ + Deleting: "Deleting", + + /** The resource create request has been accepted */ + Accepted: "Accepted", + + string, +} + +interface Operations extends Azure.ResourceManager.Operations {} +model PrivateEndpointConnection is PrivateEndpointConnectionResource; +alias PrivateEndpointOperations = PrivateEndpoints; + +@armResourceOperations +interface Employees { + get is ArmResourceRead; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + update is ArmCustomPatchSync< + Employee, + Azure.ResourceManager.Foundations.ResourceUpdateModel + >; + delete is ArmResourceDeleteSync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; + /** A sample resource action that move employee to different location */ + move is ArmResourceActionSync; + + /** A sample HEAD operation to check resource existence */ + checkExistence is ArmResourceCheckExistence; + + getPrivateEndpointConnection is PrivateEndpointOperations.Read; + createOrUpdatePrivateEndpointConnection is PrivateEndpointOperations.CreateOrUpdateAsync; + updatePrivateEndpointConnection is PrivateEndpointOperations.CustomPatchAsync; + deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync; + listPrivateEndpointConnections is PrivateEndpointOperations.ListByParent; +} + +/** Employee move request */ +model MoveRequest { + /** The moving from location */ + from: string; + + /** The moving to location */ + to: string; +} + +/** Employee move response */ +model MoveResponse { + /** The status of the move */ + movingStatus: string; +} + +@armResourceOperations +interface Dependents { + get is ArmResourceRead; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + update is ArmCustomPatchSync< + Dependent, + Azure.ResourceManager.Foundations.ResourceUpdateModel + >; + delete is ArmResourceDeleteSync; + list is ArmResourceListByParent; + getPrivateEndpointConnection is PrivateEndpointOperations.Read; + createOrUpdatePrivateEndpointConnection is PrivateEndpointOperations.CreateOrUpdateAsync; + updatePrivateEndpointConnection is PrivateEndpointOperations.CustomPatchAsync; + deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync; + listPrivateEndpointConnections is Azure.ResourceManager.Legacy.ListSinglePageByParent< + Dependent, + PrivateEndpointConnection + >; +} + +/** An employee dependent */ +@parentResource(Employee) +model Dependent is ProxyResource { + ...ResourceNameParameter; +} + +/** Dependent properties */ +model DependentProperties { + /** Age of dependent */ + age: int32; + + /** Gender of dependent */ + gender: string; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} diff --git a/packages/samples/test/output/azure/resource-manager/resource-types/private-endpoints/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json b/packages/samples/test/output/azure/resource-manager/resource-types/private-endpoints/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json new file mode 100644 index 0000000000..4166d6e0d8 --- /dev/null +++ b/packages/samples/test/output/azure/resource-manager/resource-types/private-endpoints/@azure-tools/typespec-autorest/2021-10-01-preview/openapi.json @@ -0,0 +1,1662 @@ +{ + "swagger": "2.0", + "info": { + "title": "ContosoProviderHubClient", + "version": "2021-10-01-preview", + "description": "Contoso Resource Provider management API.", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] + }, + "schemes": [ + "https" + ], + "host": "management.azure.com", + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ], + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow.", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "tags": [ + { + "name": "Operations" + }, + { + "name": "Employees" + }, + { + "name": "Dependents" + } + ], + "paths": { + "/providers/Microsoft.ContosoProviderHub/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.ContosoProviderHub/employees": { + "get": { + "operationId": "Employees_ListBySubscription", + "tags": [ + "Employees" + ], + "description": "List Employee resources by subscription ID", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/EmployeeListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees": { + "get": { + "operationId": "Employees_ListByResourceGroup", + "tags": [ + "Employees" + ], + "description": "List Employee resources by resource group", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/EmployeeListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}": { + "get": { + "operationId": "Employees_Get", + "tags": [ + "Employees" + ], + "description": "Get a Employee", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Employees_CreateOrUpdate", + "tags": [ + "Employees" + ], + "description": "Create a Employee", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/Employee" + } + } + ], + "responses": { + "200": { + "description": "Resource 'Employee' update operation succeeded", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "201": { + "description": "Resource 'Employee' create operation succeeded", + "schema": { + "$ref": "#/definitions/Employee" + }, + "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Employees_Update", + "tags": [ + "Employees" + ], + "description": "Update a Employee", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/EmployeeUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Employee" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "Employees_Delete", + "tags": [ + "Employees" + ], + "description": "Delete a Employee", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "head": { + "operationId": "Employees_CheckExistence", + "tags": [ + "Employees" + ], + "description": "A sample HEAD operation to check resource existence", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "204": { + "description": "The Azure resource exists" + }, + "404": { + "description": "The Azure resource is not found" + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents": { + "get": { + "operationId": "Dependents_List", + "tags": [ + "Dependents" + ], + "description": "List Dependent resources by Employee", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/DependentListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents/{dependentName}": { + "get": { + "operationId": "Dependents_Get", + "tags": [ + "Dependents" + ], + "description": "Get a Dependent", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Dependent" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Dependents_CreateOrUpdate", + "tags": [ + "Dependents" + ], + "description": "Create a Dependent", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/Dependent" + } + } + ], + "responses": { + "200": { + "description": "Resource 'Dependent' update operation succeeded", + "schema": { + "$ref": "#/definitions/Dependent" + } + }, + "201": { + "description": "Resource 'Dependent' create operation succeeded", + "schema": { + "$ref": "#/definitions/Dependent" + }, + "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Dependents_Update", + "tags": [ + "Dependents" + ], + "description": "Update a Dependent", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/DependentUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/Dependent" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "Dependents_Delete", + "tags": [ + "Dependents" + ], + "description": "Delete a Dependent", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents/{dependentName}/privateEndpointConnections": { + "get": { + "operationId": "Dependents_ListPrivateEndpointConnections", + "tags": [ + "Dependents" + ], + "description": "List Dependent PrivateEndpointConnections", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnectionListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents/{dependentName}/privateEndpointConnections/{privateEndpointConnectionName}": { + "get": { + "operationId": "Dependents_GetPrivateEndpointConnection", + "tags": [ + "Dependents" + ], + "description": "Get a Dependent PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Dependents_CreateOrUpdatePrivateEndpointConnection", + "tags": [ + "Dependents" + ], + "description": "Create a Dependent PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + } + ], + "responses": { + "200": { + "description": "Resource 'PrivateEndpointConnection' update operation succeeded", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "201": { + "description": "Resource 'PrivateEndpointConnection' create operation succeeded", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + }, + "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Dependents_UpdatePrivateEndpointConnection", + "tags": [ + "Dependents" + ], + "description": "Update a Dependent PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/Azure.ResourceManager.PrivateEndpointConnectionUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "Dependents_DeletePrivateEndpointConnection", + "tags": [ + "Dependents" + ], + "description": "Delete a Dependent PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "dependentName", + "in": "path", + "description": "The name of the Dependent", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + } + ], + "responses": { + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/move": { + "post": { + "operationId": "Employees_Move", + "tags": [ + "Employees" + ], + "description": "A sample resource action that move employee to different location", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "name": "body", + "in": "body", + "description": "The content of the action request", + "required": true, + "schema": { + "$ref": "#/definitions/MoveRequest" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/MoveResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/privateEndpointConnections": { + "get": { + "operationId": "Employees_ListPrivateEndpointConnections", + "tags": [ + "Employees" + ], + "description": "List Employee PrivateEndpointConnections", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/PrivateEndpointConnectionListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/privateEndpointConnections/{privateEndpointConnectionName}": { + "get": { + "operationId": "Employees_GetPrivateEndpointConnection", + "tags": [ + "Employees" + ], + "description": "Get a Employee PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "Employees_CreateOrUpdatePrivateEndpointConnection", + "tags": [ + "Employees" + ], + "description": "Create a Employee PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + } + ], + "responses": { + "200": { + "description": "Resource 'PrivateEndpointConnection' update operation succeeded", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "201": { + "description": "Resource 'PrivateEndpointConnection' create operation succeeded", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + }, + "headers": { + "Azure-AsyncOperation": { + "type": "string", + "description": "A link to the status monitor" + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "Employees_UpdatePrivateEndpointConnection", + "tags": [ + "Employees" + ], + "description": "Update a Employee PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/Azure.ResourceManager.PrivateEndpointConnectionUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "Employees_DeletePrivateEndpointConnection", + "tags": [ + "Employees" + ], + "description": "Delete a Employee PrivateEndpointConnection", + "parameters": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "employeeName", + "in": "path", + "description": "The name of the Employee", + "required": true, + "type": "string", + "pattern": "^[a-zA-Z0-9-]{3,24}$" + }, + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/parameters/PrivateEndpointConnectionName" + } + ], + "responses": { + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + } + }, + "definitions": { + "Azure.ResourceManager.PrivateEndpointConnectionUpdate": { + "type": "object", + "description": "PATCH model for private endpoint connections", + "properties": { + "properties": { + "type": "object", + "description": "The private endpoint connection properties", + "properties": { + "privateEndpoint": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpoint", + "description": "The private endpoint resource." + }, + "privateLinkServiceConnectionState": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateLinkServiceConnectionState", + "description": "A collection of information about the state of the connection between service consumer and provider." + } + } + } + } + }, + "Dependent": { + "type": "object", + "description": "An employee dependent", + "properties": { + "properties": { + "$ref": "#/definitions/DependentProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true + } + }, + "allOf": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/ProxyResource" + } + ] + }, + "DependentListResult": { + "type": "object", + "description": "The response of a Dependent list operation.", + "properties": { + "value": { + "type": "array", + "description": "The Dependent items on this page", + "items": { + "$ref": "#/definitions/Dependent" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "DependentProperties": { + "type": "object", + "description": "Dependent properties", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of dependent" + }, + "gender": { + "type": "string", + "description": "Gender of dependent" + }, + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "The status of the last operation.", + "readOnly": true + } + }, + "required": [ + "age", + "gender" + ] + }, + "DependentUpdate": { + "type": "object", + "description": "The type used for update operations of the Dependent.", + "properties": { + "properties": { + "$ref": "#/definitions/DependentUpdateProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true + } + } + }, + "DependentUpdateProperties": { + "type": "object", + "description": "The updatable properties of the Dependent.", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of dependent" + }, + "gender": { + "type": "string", + "description": "Gender of dependent" + } + } + }, + "Employee": { + "type": "object", + "description": "A ContosoProviderHub resource", + "properties": { + "properties": { + "$ref": "#/definitions/EmployeeProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true + } + }, + "allOf": [ + { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/types.json#/definitions/TrackedResource" + } + ] + }, + "EmployeeListResult": { + "type": "object", + "description": "The response of a Employee list operation.", + "properties": { + "value": { + "type": "array", + "description": "The Employee items on this page", + "items": { + "$ref": "#/definitions/Employee" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "EmployeeProperties": { + "type": "object", + "description": "Employee properties", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of employee" + }, + "city": { + "type": "string", + "description": "City of employee" + }, + "profile": { + "type": "string", + "format": "base64url", + "description": "Profile of employee" + }, + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "The status of the last operation.", + "readOnly": true + } + } + }, + "EmployeeUpdate": { + "type": "object", + "description": "The type used for update operations of the Employee.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + }, + "properties": { + "$ref": "#/definitions/EmployeeUpdateProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true + } + } + }, + "EmployeeUpdateProperties": { + "type": "object", + "description": "The updatable properties of the Employee.", + "properties": { + "age": { + "type": "integer", + "format": "int32", + "description": "Age of employee" + }, + "city": { + "type": "string", + "description": "City of employee" + }, + "profile": { + "type": "string", + "format": "base64url", + "description": "Profile of employee" + } + } + }, + "MoveRequest": { + "type": "object", + "description": "Employee move request", + "properties": { + "from": { + "type": "string", + "description": "The moving from location" + }, + "to": { + "type": "string", + "description": "The moving to location" + } + }, + "required": [ + "from", + "to" + ] + }, + "MoveResponse": { + "type": "object", + "description": "Employee move response", + "properties": { + "movingStatus": { + "type": "string", + "description": "The status of the move" + } + }, + "required": [ + "movingStatus" + ] + }, + "PrivateEndpointConnectionListResult": { + "type": "object", + "description": "The response of a PrivateEndpointConnection list operation.", + "properties": { + "value": { + "type": "array", + "description": "The PrivateEndpointConnection items on this page", + "items": { + "$ref": "../../../../../../../../../specs/resource-manager/common-types/v5/privatelinks.json#/definitions/PrivateEndpointConnection" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "ProvisioningState": { + "type": "string", + "description": "The provisioning state of a resource.", + "enum": [ + "Succeeded", + "Failed", + "Canceled", + "Provisioning", + "Updating", + "Deleting", + "Accepted" + ], + "x-ms-enum": { + "name": "ProvisioningState", + "modelAsString": true, + "values": [ + { + "name": "Succeeded", + "value": "Succeeded", + "description": "Resource has been created." + }, + { + "name": "Failed", + "value": "Failed", + "description": "Resource creation failed." + }, + { + "name": "Canceled", + "value": "Canceled", + "description": "Resource creation was canceled." + }, + { + "name": "Provisioning", + "value": "Provisioning", + "description": "The resource is being provisioned" + }, + { + "name": "Updating", + "value": "Updating", + "description": "The resource is updating" + }, + { + "name": "Deleting", + "value": "Deleting", + "description": "The resource is being deleted" + }, + { + "name": "Accepted", + "value": "Accepted", + "description": "The resource create request has been accepted" + } + ] + }, + "readOnly": true + } + }, + "parameters": {} +} diff --git a/packages/typespec-azure-resource-manager/README.md b/packages/typespec-azure-resource-manager/README.md index b83afcffbb..72e20817a3 100644 --- a/packages/typespec-azure-resource-manager/README.md +++ b/packages/typespec-azure-resource-manager/README.md @@ -340,9 +340,9 @@ Azure.ResourceManager common types. ##### Parameters -| Name | Type | Description | -| -------- | ---------------- | ----------- | -| provider | `valueof string` | | +| Name | Type | Description | +| -------- | ---------------- | ------------------------------------------------------------------- | +| provider | `valueof string` | Optional. The resource provider namespace for the virtual resource. | #### `@extensionResource` @@ -429,9 +429,9 @@ This decorator sets the base type of the given resource. ##### Parameters -| Name | Type | Description | -| ---------- | ---------------------------------------------------------------------------- | ----------- | -| baseTypeIt | `"Tenant" \| "Subscription" \| "ResourceGroup" \| "Location" \| "Extension"` | | +| Name | Type | Description | +| ---------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| baseTypeIt | `"Tenant" \| "Subscription" \| "ResourceGroup" \| "Location" \| "Extension"` | The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" | #### `@resourceGroupResource` diff --git a/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.Private.ts b/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.Private.ts index 90d7c36219..71ffcce520 100644 --- a/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.Private.ts +++ b/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.Private.ts @@ -110,6 +110,23 @@ export type ArmResourceInternalDecorator = ( properties: Model, ) => void; +/** + * This decorator identifies Azure Resource Manager resource types that do not define + * the name identifier parameter and type + * + * @param target Azure Resource Manager resource type + * @param properties Azure Resource Manager resource properties + * @param type The resource type name, e.g. "virtualMachines" + * @param nameParameter The name of the resource name parameter, e.g. "virtualMachineName" + */ +export type ArmResourceWithParameterDecorator = ( + context: DecoratorContext, + target: Model, + properties: Model, + type: string, + nameParameter: string, +) => void; + /** * Provides default name decoration on resource name property with * camelcased and pluralized key and segment name @@ -184,6 +201,7 @@ export type AzureResourceManagerPrivateDecorators = { armUpdateProviderNamespace: ArmUpdateProviderNamespaceDecorator; assignUniqueProviderNameValue: AssignUniqueProviderNameValueDecorator; armResourceInternal: ArmResourceInternalDecorator; + armResourceWithParameter: ArmResourceWithParameterDecorator; defaultResourceKeySegmentName: DefaultResourceKeySegmentNameDecorator; enforceConstraint: EnforceConstraintDecorator; armRenameListByOperation: ArmRenameListByOperationDecorator; diff --git a/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.ts b/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.ts index d1cc75c8ac..706a274b1f 100644 --- a/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.ts +++ b/packages/typespec-azure-resource-manager/generated-defs/Azure.ResourceManager.ts @@ -262,6 +262,7 @@ export type ArmCommonTypesVersionDecorator = ( * Azure.ResourceManager common types. * * @param propertiesType : The type of the resource properties. + * @param provider Optional. The resource provider namespace for the virtual resource. */ export type ArmVirtualResourceDecorator = ( context: DecoratorContext, @@ -272,7 +273,7 @@ export type ArmVirtualResourceDecorator = ( /** * This decorator sets the base type of the given resource. * - * @param baseType The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" + * @param baseTypeIt The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" */ export type ResourceBaseTypeDecorator = ( context: DecoratorContext, diff --git a/packages/typespec-azure-resource-manager/lib/Legacy/arm.legacy.tsp b/packages/typespec-azure-resource-manager/lib/Legacy/arm.legacy.tsp index 7380b17c12..4ff7d5ac4e 100644 --- a/packages/typespec-azure-resource-manager/lib/Legacy/arm.legacy.tsp +++ b/packages/typespec-azure-resource-manager/lib/Legacy/arm.legacy.tsp @@ -4,5 +4,6 @@ import "./operations.tsp"; import "./interfaces.tsp"; import "./extension.tsp"; import "./extension-operations.tsp"; +import "./private-endpoints.tsp"; namespace Azure.ResourceManager.Legacy; diff --git a/packages/typespec-azure-resource-manager/lib/Legacy/operations.tsp b/packages/typespec-azure-resource-manager/lib/Legacy/operations.tsp index b6a74b6a37..a1e09c1a3c 100644 --- a/packages/typespec-azure-resource-manager/lib/Legacy/operations.tsp +++ b/packages/typespec-azure-resource-manager/lib/Legacy/operations.tsp @@ -535,6 +535,7 @@ op CreateOrUpdateSync< * @template BodyParameter The body parameter * @template Response The response or union of responses for success. * @template ErrorResponse The error response. + * @template OptionalRequestBody Optional. Indicates whether the request body is optional */ op CreateOperation< HttpParameters extends {}, diff --git a/packages/typespec-azure-resource-manager/lib/Legacy/private-endpoints.tsp b/packages/typespec-azure-resource-manager/lib/Legacy/private-endpoints.tsp new file mode 100644 index 0000000000..105bb6314d --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/Legacy/private-endpoints.tsp @@ -0,0 +1,39 @@ +import "@typespec/rest"; +import "@typespec/http"; + +namespace Azure.ResourceManager.Legacy; + +using Http; +using Azure.ResourceManager.Foundations; +using Rest; + +/** + * @dev List the private endpoint connections over a resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource Optional. The PrivateEndpointConnection resource being listed + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template ParentName Optional. The name of the parent resource + * @template ParentFriendlyName Optional. The friendly name of the parent resource + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the list operation + * @template Error Optional. The error response, if non-standard. + */ +@doc("List {name} PrivateEndpointConnections", ParentResource) +@get +@autoRoute +@listsResource(Resource) +@segmentOf(PrivateEndpointConnectionParameter) +@armResourceList(Resource) +@Private.enforceConstraint(ParentResource, Foundations.Resource) +op ListSinglePageByParent< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmResponse>, + Error extends {} = ErrorResponse +> is ArmReadOperation< + ResourceInstanceParameters & Parameters, + Response, + Error +>; diff --git a/packages/typespec-azure-resource-manager/lib/arm.tsp b/packages/typespec-azure-resource-manager/lib/arm.tsp index 443205d238..173ba7c6ac 100644 --- a/packages/typespec-azure-resource-manager/lib/arm.tsp +++ b/packages/typespec-azure-resource-manager/lib/arm.tsp @@ -17,6 +17,7 @@ import "./decorators.tsp"; import "./interfaces.tsp"; import "./responses.tsp"; import "./parameters.tsp"; +import "./private-endpoints.tsp"; using Http; using Rest; diff --git a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp index 08c8592826..4fc9eaa698 100644 --- a/packages/typespec-azure-resource-manager/lib/common-types/types.tsp +++ b/packages/typespec-azure-resource-manager/lib/common-types/types.tsp @@ -344,6 +344,8 @@ union createdByType { string, } +/** @dev Resource Identity Type */ +@doc("") union ResourceIdentityType { SystemAssigned: "SystemAssigned", } @@ -367,6 +369,7 @@ model Identity { type?: ResourceIdentityType; } +/** @dev Properties of a KeyVault */ model KeyVaultProperties { /** Key vault uri to access the encryption key. */ keyIdentifier?: string; diff --git a/packages/typespec-azure-resource-manager/lib/decorators.tsp b/packages/typespec-azure-resource-manager/lib/decorators.tsp index 4b953959df..3c42ce6ca9 100644 --- a/packages/typespec-azure-resource-manager/lib/decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/decorators.tsp @@ -211,13 +211,14 @@ extern dec armCommonTypesVersion( * Azure.ResourceManager common types. * * @param propertiesType: The type of the resource properties. + * @param provider Optional. The resource provider namespace for the virtual resource. */ extern dec armVirtualResource(target: Model, provider?: valueof string); /** * This decorator sets the base type of the given resource. * - * @param baseType The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" + * @param baseTypeIt The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" */ extern dec resourceBaseType( target: Model, diff --git a/packages/typespec-azure-resource-manager/lib/interfaces.tsp b/packages/typespec-azure-resource-manager/lib/interfaces.tsp index 01865a621f..8e3f0b664c 100644 --- a/packages/typespec-azure-resource-manager/lib/interfaces.tsp +++ b/packages/typespec-azure-resource-manager/lib/interfaces.tsp @@ -13,6 +13,9 @@ namespace Azure.ResourceManager; * GET "/providers/Microsoft.ContosoProviderHub/operations" */ interface Operations { + /** + * @dev List the operations for the provider. + */ @tag("Operations") @autoRoute @armUpdateProviderNamespace diff --git a/packages/typespec-azure-resource-manager/lib/private-endpoints.tsp b/packages/typespec-azure-resource-manager/lib/private-endpoints.tsp new file mode 100644 index 0000000000..8d627f0cff --- /dev/null +++ b/packages/typespec-azure-resource-manager/lib/private-endpoints.tsp @@ -0,0 +1,379 @@ +using Http; +using Rest; +using Azure.ResourceManager.Foundations; +using Azure.ResourceManager.Private; + +namespace Azure.ResourceManager; + +/** + * A private endpoint connection resource. + * Resource providers must declare a private endpoint connection resource type in their provider namespace if + * they support private endpoint connections + * @template Description Optional. The documentary description of the private endpoint connection resource name parameter. + * + * @example + * ```ts + * namespace Microsoft.Contoso; + * model PrivateEndpointConnection is PrivateEndpointConnectionResource {} + * alias EmployeeConnectionOps is PrivateEndpoints; + * @armResourceOperations + * interface Employees { + * @doc("get a private endpoint connection for resource employee") + * getPrivateEndpointConnection is EmployeeConnectionOps.Read; + * } + * ``` + */ +@doc(Description) +@armResourceWithParameter( + CommonTypes.PrivateEndpointConnectionProperties, + "privateEndpointConnections", + "privateEndpointConnectionName" +) +@Http.Private.includeInapplicableMetadataInPayload(false) +model PrivateEndpointConnectionResource + is CommonTypes.PrivateEndpointConnection; + +/** + * Operations over private endpoint connection resources. + * @template PrivateEndpointResource The type of the private endpoint connection resource. You must declare a private endpoint connection resource type in your provider namespace. + * + * @example + * ```ts + * namespace Microsoft.Contoso; + * model PrivateEndpointConnection is PrivateEndpointConnectionResource {} + * alias EmployeeConnectionOps is PrivateEndpoints; + * @armResourceOperations + * interface Employees { + * @doc("get a private endpoint connection for resource employee") + * getPrivateEndpointConnection is EmployeeConnectionOps.Read; + * } + * ``` + */ +interface PrivateEndpoints { + /** + * @dev List the private endpoint connections over a resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource Optional. The PrivateEndpointConnection resource being listed + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template ParentName Optional. The name of the parent resource + * @template ParentFriendlyName Optional. The friendly name of the parent resource + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the list operation + * @template Error Optional. The error response, if non-standard. + */ + @doc("List {name} PrivateEndpointConnections", ParentResource) + @get + @autoRoute + @list + @listsResource(Resource) + @segmentOf(PrivateEndpointConnectionParameter) + @armResourceList(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + ListByParent< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmResponse>, + Error extends {} = ErrorResponse + > is ArmReadOperation< + ResourceInstanceParameters & Parameters, + Response, + Error + >; + + /** + * @dev GET the a private endpoint connection for a particular resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource the PrivateEndpointConnection resource being read + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the read operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Get a {name} PrivateEndpointConnection", ParentResource) + @get + @armResourceRead(Resource) + Read< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmResponse, + Error extends {} = ErrorResponse + > is ArmReadOperation< + ResourceInstanceParameters & + KeysOf & + Parameters, + Response, + Error + >; + + /** + * @dev A long-running resource CreateOrUpdate (PUT) for a PrivateEndpointConnection to a resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource the PrivateEndpointConnection resource being created or updated + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template LroHeaders Optional. Allows overriding the lro headers returned on resource create + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the createOrUpdate operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Create a {name} PrivateEndpointConnection", ParentResource) + @armResourceCreateOrUpdate(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @Azure.Core.Foundations.Private.defaultFinalStateVia(#["location", "azure-async-operation"]) + @put + CreateOrUpdateAsync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + LroHeaders extends TypeSpec.Reflection.Model = ArmAsyncOperationHeader & + Azure.Core.Foundations.RetryAfterHeader, + Parameters extends {} = {}, + Response extends {} = ArmResourceUpdatedResponse | ArmResourceCreatedResponse< + Resource, + LroHeaders + >, + Error extends {} = ErrorResponse + > is ArmCreateOperation< + ResourceInstanceParameters & + KeysOf & + Parameters, + Resource, + Response, + Error + >; + + /** + * @dev Synchronous PUT operation for a Private endpoint connection to a resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource the PrivateEndpointConnection resource being created or updated + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the createOrUpdate operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Create a {name} PrivateEndpointConnection", ParentResource) + @armResourceCreateOrUpdate(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @put + CreateOrReplaceSync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmResourceUpdatedResponse | ArmResourceCreatedSyncResponse, + Error extends {} = ErrorResponse + > is ArmCreateOperation< + ResourceInstanceParameters & + KeysOf & + Parameters, + Resource, + Response, + Error + >; + + /** + * @dev A long-running resource CreateOrUpdate (PUT) for a PrivateEndpointConnection to a resource + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource the PrivateEndpointConnection resource being created or updated + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template LroHeaders Optional. Allows overriding the lro headers returned on resource create + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the createOrReplace operation + * @template Error Optional. The error response, if non-standard. + */ + @Private.enforceConstraint(ParentResource, Foundations.Resource) + CreateOrReplaceAsync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + LroHeaders extends TypeSpec.Reflection.Model = ArmAsyncOperationHeader & + Azure.Core.Foundations.RetryAfterHeader, + Parameters extends {} = {}, + Response extends {} = ArmResourceUpdatedResponse | ArmResourceCreatedResponse< + Resource, + LroHeaders + >, + Error extends {} = ErrorResponse + > is PrivateEndpoints.CreateOrUpdateAsync< + ParentResource, + Resource, + BaseParameters, + LroHeaders, + Parameters, + Response, + Error + >; + + /** + * A long-running resource update using a custom PATCH payload (Asynchronous) to update a PrivateEndpointConnection to a resource. + * @template ParentResource the parent resource of the PrivateEndpointConnection + * @template Resource the PrivateEndpointConnection resource being updated + * @template PatchModel The input model for the PATCH request + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template LroHeaders Optional. Allows overriding the lro headers returned in the Accepted response + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the patch operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Update a {name} PrivateEndpointConnection", ParentResource) + @armResourceUpdate(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @patch(#{ implicitOptionality: false }) + CustomPatchAsync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + PatchModel extends TypeSpec.Reflection.Model = PrivateEndpointConnectionUpdate, + BaseParameters = DefaultBaseParameters, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader< + Azure.Core.StatusMonitorPollingOptions, + Resource, + string + > & + Azure.Core.Foundations.RetryAfterHeader, + Parameters extends {} = {}, + Response extends {} = ArmResponse | ArmAcceptedLroResponse< + "Resource update request accepted.", + LroHeaders + >, + Error extends {} = ErrorResponse + > is ArmUpdateOperation< + ResourceInstanceParameters & + KeysOf & + Parameters, + PatchModel, + Response, + Error + >; + + /** + * @dev A resource update using a custom PATCH payload (synchronous) to update a PrivateEndpointConnection to a resource + * @template ParentResource The parent resource of the PrivateEndpointConnection + * @template Resource Optional. The PrivateEndpointConnection resource being patched + * @template PatchModel The input model for the PATCH request + * @template BaseParameters Optional. Allows overriding the operation parameters + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response for the patch operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Update a {name PrivateEndpointConnection}", ParentResource) + @armResourceUpdate(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @patch(#{ implicitOptionality: false }) + CustomPatchSync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + PatchModel extends TypeSpec.Reflection.Model = PrivateEndpointConnectionUpdate, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmResponse, + Error extends {} = ErrorResponse + > is ArmUpdateOperation< + ResourceInstanceParameters & + KeysOf & + Parameters, + PatchModel, + Response, + Error + >; + + /** + * @dev Delete a PrivateEndpointConnection to a resource asynchronously + * @template ParentResource The parent resource of the PrivateEndpointConnection + * @template Resource Optional. The PrivateEndpointConnection resource being deleted + * @template BaseParameters Optional. Allows overriding the parameters for the operation + * @template LroHeaders Optional. Allows overriding the headers returned in the Accepted response + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response(s) for the delete operation + * @template Error Optional. The error response, if non-standard. + */ + @Private.enforceConstraint(ParentResource, Foundations.Resource) + DeleteAsync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader & + Azure.Core.Foundations.RetryAfterHeader, + Parameters extends {} = {}, + Response extends {} = ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse, + Error extends {} = ErrorResponse + > is PrivateEndpoints.DeleteAsyncBase< + ParentResource, + Response, + Resource, + BaseParameters, + Parameters, + Error + >; + + /** + * @dev Delete a PrivateEndpointConnection to a resource synchronously + * @template ParentResource The parent resource of the PrivateEndpointConnection + * @template Resource The PrivateEndpointConnection resource being deleted + * @template BaseParameters Optional. Allows overriding the parameters for the operation + * @template Parameters Optional. Additional parameters after the path parameters + * @template Response Optional. The success response(s) for the delete operation + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Delete a {name} PrivateEndpointConnection", ParentResource) + @armResourceDelete(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @delete + DeleteSync< + ParentResource extends Foundations.SimpleResource, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Response extends {} = ArmDeletedResponse | ArmDeletedNoContentResponse, + Error = ErrorResponse + >( + ...ResourceInstanceParameters, + ...KeysOf, + ...Parameters, + ): Response | Error; + + /** + * @dev Delete a PrivateEndpointConnection to a resource asynchronously + * @template ParentResource The parent resource of the PrivateEndpointConnection + * @template Response The response type for the operation + * @template Resource Optional. The PrivateEndpointConnection resource being deleted + * @template BaseParameters Optional. Allows overriding the parameters for the operation + * @template Parameters Optional. Additional parameters after the path parameters + * @template Error Optional. The error response, if non-standard. + */ + @autoRoute + @doc("Delete a {name} PrivateEndpointConnection", ParentResource) + @armResourceDelete(Resource) + @Private.enforceConstraint(ParentResource, Foundations.Resource) + @delete + DeleteAsyncBase< + ParentResource extends Foundations.SimpleResource, + Response, + Resource extends PrivateEndpointConnectionResource = PrivateEndpointResource, + BaseParameters = DefaultBaseParameters, + Parameters extends {} = {}, + Error extends {} = ErrorResponse + >( + ...ResourceInstanceParameters, + ...KeysOf, + ...Parameters, + ): Response | Error; +} + +/** PATCH model for private endpoint connections */ +model PrivateEndpointConnectionUpdate + is OptionalProperties>> { + /** The private endpoint connection properties */ + properties?: OptionalProperties>; +} diff --git a/packages/typespec-azure-resource-manager/lib/private.decorators.tsp b/packages/typespec-azure-resource-manager/lib/private.decorators.tsp index c15f3297ff..04b1041c27 100644 --- a/packages/typespec-azure-resource-manager/lib/private.decorators.tsp +++ b/packages/typespec-azure-resource-manager/lib/private.decorators.tsp @@ -34,6 +34,21 @@ extern dec assignUniqueProviderNameValue(target: ModelProperty, resource: Model) */ extern dec armResourceInternal(target: Model, properties: Model); +/** + * This decorator identifies Azure Resource Manager resource types that do not define + * the name identifier parameter and type + * @param target Azure Resource Manager resource type + * @param properties Azure Resource Manager resource properties + * @param type The resource type name, e.g. "virtualMachines" + * @param nameParameter The name of the resource name parameter, e.g. "virtualMachineName" + */ +extern dec armResourceWithParameter( + target: Model, + properties: Model, + type: valueof string, + nameParameter: valueof string +); + /** * Omit a property in the target model. * @internal diff --git a/packages/typespec-azure-resource-manager/src/common-types.ts b/packages/typespec-azure-resource-manager/src/common-types.ts index f73adc939b..eee03abbbb 100644 --- a/packages/typespec-azure-resource-manager/src/common-types.ts +++ b/packages/typespec-azure-resource-manager/src/common-types.ts @@ -122,7 +122,7 @@ export const $armCommonTypesVersion: ArmCommonTypesVersionDecorator = ( /** * Returns the ARM common-types version used by the service. - * @param {DecoratorContext} context DecoratorContext object + * @param {Program} program Program object * @param {type} entity Target of the decorator. Must be `Namespace` or `EnumMember` type */ export function getArmCommonTypesVersion( diff --git a/packages/typespec-azure-resource-manager/src/namespace.ts b/packages/typespec-azure-resource-manager/src/namespace.ts index 8f73a4ece1..2b81f09176 100644 --- a/packages/typespec-azure-resource-manager/src/namespace.ts +++ b/packages/typespec-azure-resource-manager/src/namespace.ts @@ -26,10 +26,7 @@ import { reportDiagnostic } from "./lib.js"; import { getArmVirtualResourceDetails, getSingletonResourceKey } from "./resource.js"; import { ArmStateKeys } from "./state.js"; -function getArmCommonTypesVersion( - context: DecoratorContext, - entity: Namespace | EnumMember, -): EnumValue | undefined { +function getArmCommonTypesVersion(entity: Namespace | EnumMember): EnumValue | undefined { return entity.decorators.find((x) => x.definition?.name === "@armCommonTypesVersion")?.args[0] .jsValue as EnumValue | undefined; } @@ -169,7 +166,7 @@ export const $armProviderNamespace: ArmProviderNamespaceDecorator = ( } } - const armCommonTypesVersion = getArmCommonTypesVersion(context, entity); + const armCommonTypesVersion = getArmCommonTypesVersion(entity); // If it is versioned namespace, we will check each Version enum member. If no // @armCommonTypeVersion decorator, add the one @@ -177,7 +174,7 @@ export const $armProviderNamespace: ArmProviderNamespaceDecorator = ( if (versioned) { const versionEnum = versioned.args[0].value as Enum; versionEnum.members.forEach((v) => { - if (!getArmCommonTypesVersion(context, v)) { + if (!getArmCommonTypesVersion(v)) { context.call($armCommonTypesVersion, v, armCommonTypesVersion ?? "v3"); } }); diff --git a/packages/typespec-azure-resource-manager/src/private.decorators.ts b/packages/typespec-azure-resource-manager/src/private.decorators.ts index 061b65499e..59fb8051a1 100644 --- a/packages/typespec-azure-resource-manager/src/private.decorators.ts +++ b/packages/typespec-azure-resource-manager/src/private.decorators.ts @@ -34,6 +34,7 @@ import { ArmRenameListByOperationDecorator, ArmResourceInternalDecorator, ArmResourcePropertiesOptionalityDecorator, + ArmResourceWithParameterDecorator, ArmUpdateProviderNamespaceDecorator, AssignProviderNameValueDecorator, AssignUniqueProviderNameValueDecorator, @@ -51,6 +52,7 @@ import { getArmProviderNamespace, isArmLibraryNamespace } from "./namespace.js"; import { armRenameListByOperationInternal } from "./operations.js"; import { ArmResourceDetails, + ArmResourceKind, ResourceBaseType, getArmResourceKind, getArmVirtualResourceDetails, @@ -383,6 +385,15 @@ const $armResourceInternal: ArmResourceInternalDecorator = ( registerArmResource(context, resourceType); }; +const $armResourceWithParameter: ArmResourceWithParameterDecorator = ( + context: DecoratorContext, + target: Model, + properties: Model, + type: string, + nameParameter: string, +) => { + registerArmResource(context, target, type, nameParameter); +}; function getPrimaryKeyProperty(program: Program, resource: Model): ModelProperty | undefined { const nameProperty = resource.properties.get("name"); if (nameProperty !== undefined) return nameProperty; @@ -391,7 +402,12 @@ function getPrimaryKeyProperty(program: Program, resource: Model): ModelProperty return keyProps[0]; } -export function registerArmResource(context: DecoratorContext, resourceType: Model): void { +export function registerArmResource( + context: DecoratorContext, + resourceType: Model, + type?: string, + nameParameter?: string, +): void { const { program } = context; if (resourceType.namespace && getTypeName(resourceType.namespace) === "Azure.ResourceManager") { // The @armResource decorator will be evaluated on instantiations of @@ -419,43 +435,60 @@ export function registerArmResource(context: DecoratorContext, resourceType: Mod return; } - // Ensure the resource type has defined a name property that has a segment - const primaryKeyProperty = getPrimaryKeyProperty(program, resourceType); - if (!primaryKeyProperty) { - reportDiagnostic(program, { code: "arm-resource-missing-name-property", target: resourceType }); - return; - } + let keyName: string | undefined = undefined; + let collectionName: string | undefined = undefined; + let kind: ArmResourceKind | undefined = undefined; - // Set the name property to be read only - if (primaryKeyProperty.name === "name") { - const Lifecycle = getLifecycleVisibilityEnum(program); - clearVisibilityModifiersForClass(program, primaryKeyProperty, Lifecycle, context); - addVisibilityModifiers(program, primaryKeyProperty, [Lifecycle.members.get("Read")!], context); - sealVisibilityModifiers(program, primaryKeyProperty, Lifecycle); - } + if (type !== undefined && nameParameter !== undefined) { + keyName = nameParameter; + collectionName = type; + kind = "Proxy"; + } else { + // Ensure the resource type has defined a name property that has a segment + const primaryKeyProperty = getPrimaryKeyProperty(program, resourceType); + if (!primaryKeyProperty) { + reportDiagnostic(program, { + code: "arm-resource-missing-name-property", + target: resourceType, + }); + return; + } - const keyName = getKeyName(program, primaryKeyProperty); - if (!keyName) { - reportDiagnostic(program, { - code: "arm-resource-missing-name-key-decorator", - target: resourceType, - }); - return; - } + // Set the name property to be read only + if (primaryKeyProperty.name === "name") { + const Lifecycle = getLifecycleVisibilityEnum(program); + clearVisibilityModifiersForClass(program, primaryKeyProperty, Lifecycle, context); + addVisibilityModifiers( + program, + primaryKeyProperty, + [Lifecycle.members.get("Read")!], + context, + ); + sealVisibilityModifiers(program, primaryKeyProperty, Lifecycle); + } - const collectionName = getSegment(program, primaryKeyProperty); - if (!collectionName) { - reportDiagnostic(program, { - code: "arm-resource-missing-name-segment-decorator", - target: resourceType, - }); - return; - } + keyName = getKeyName(program, primaryKeyProperty); + if (!keyName) { + reportDiagnostic(program, { + code: "arm-resource-missing-name-key-decorator", + target: resourceType, + }); + return; + } - let kind = getArmResourceKind(resourceType); - if (isArmVirtualResource(program, resourceType)) kind = "Virtual"; - if (isCustomAzureResource(program, resourceType)) kind = "Custom"; + collectionName = getSegment(program, primaryKeyProperty); + if (!collectionName) { + reportDiagnostic(program, { + code: "arm-resource-missing-name-segment-decorator", + target: resourceType, + }); + return; + } + kind = getArmResourceKind(resourceType); + if (isArmVirtualResource(program, resourceType)) kind = "Virtual"; + if (isCustomAzureResource(program, resourceType)) kind = "Custom"; + } if (!kind) { reportDiagnostic(program, { code: "arm-resource-invalid-base-type", @@ -592,6 +625,7 @@ export const $decorators = { armRenameListByOperation: $armRenameListByOperation, armResourcePropertiesOptionality: $armResourcePropertiesOptionality, armBodyRoot: $armBodyRoot, + armResourceWithParameter: $armResourceWithParameter, } satisfies AzureResourceManagerPrivateDecorators, "Azure.ResourceManager.Extension.Private": { builtInResource: $builtInResource, diff --git a/packages/typespec-azure-resource-manager/src/resource.ts b/packages/typespec-azure-resource-manager/src/resource.ts index 3e72df28e0..6dd9b80718 100644 --- a/packages/typespec-azure-resource-manager/src/resource.ts +++ b/packages/typespec-azure-resource-manager/src/resource.ts @@ -906,7 +906,7 @@ export const $identifiers: IdentifiersDecorator = ( }; /** - * This function returns identifiers using the @identifiers decorator + * This function returns identifiers using the '@identifiers' decorator * * @param program The program to process. * @param entity The array model type to check. @@ -917,7 +917,7 @@ export function getArmIdentifiers(program: Program, entity: ModelProperty): stri } /** - * This function returns identifiers using the @key decorator. + * This function returns identifiers using the '@key' decorator. * * @param program The program to process. * @param entity The array model type to check. diff --git a/packages/typespec-azure-resource-manager/src/rules/arm-resource-operation-response.ts b/packages/typespec-azure-resource-manager/src/rules/arm-resource-operation-response.ts index 5ad0bef677..e8ff0bce46 100644 --- a/packages/typespec-azure-resource-manager/src/rules/arm-resource-operation-response.ts +++ b/packages/typespec-azure-resource-manager/src/rules/arm-resource-operation-response.ts @@ -52,23 +52,27 @@ function checkArmResourceOperationReturnType( if (!isInternalTypeSpec(context.program, operation)) { const returnType = operation.returnType; if (returnType.kind === "Model") { - checkIfArmModel(context, operation, model, returnType); + throwIfNotMatchingArmModel(context, operation, model, returnType); } else if (returnType.kind === "Union") { for (const variant of returnType.variants.values()) { if (!isErrorType(variant.type) && variant.type.kind === "Model") { const modelCandidate = getEffectiveModelType(context.program, variant.type); - checkIfArmModel(context, operation, model, modelCandidate); + throwIfNotMatchingArmModel(context, operation, model, modelCandidate); if (modelCandidate.templateMapper !== undefined) { // ArmResponse for (const arg of modelCandidate.templateMapper.args) { if (isType(arg) && arg.kind === "Model") { - checkIfArmModel(context, operation, model, arg); + throwIfNotMatchingArmModel(context, operation, model, arg); if (arg.templateMapper !== undefined) { - // ArmResponse> - for (const type of arg.templateMapper.args) { - if (isType(type) && type.kind === "Model") { - checkIfArmModel(context, operation, model, type); - } + const modelArgs = arg.templateMapper.args.filter( + (a) => isType(a) && a.kind === "Model", + ); + const resourceArgs = modelArgs.filter( + (a) => getArmResource(context.program, a) !== undefined, + ); + // if there is only one ARM resource argument, it must match the expected ARM resource + if (resourceArgs.length === 1) { + throwIfNotMatchingArmModel(context, operation, model, resourceArgs[0]); } } } @@ -78,17 +82,17 @@ function checkArmResourceOperationReturnType( } } } -} -function checkIfArmModel( - context: LinterRuleContext, - operation: Operation, - model: Model, - modelCandidate: Model, -) { - if (getArmResource(context.program, modelCandidate) && modelCandidate !== model) { - context.reportDiagnostic({ - target: operation, - }); + function throwIfNotMatchingArmModel( + context: LinterRuleContext, + operation: Operation, + model: Model, + modelCandidate: Model, + ) { + if (getArmResource(context.program, modelCandidate) !== undefined && modelCandidate !== model) { + context.reportDiagnostic({ + target: operation, + }); + } } } diff --git a/packages/typespec-azure-resource-manager/test/resource-resolution.test.ts b/packages/typespec-azure-resource-manager/test/resource-resolution.test.ts index 20c19a3763..812fd4efad 100644 --- a/packages/typespec-azure-resource-manager/test/resource-resolution.test.ts +++ b/packages/typespec-azure-resource-manager/test/resource-resolution.test.ts @@ -1049,4 +1049,327 @@ interface GenericResources { { operationGroup: "Operations", name: "list", kind: "other" }, ]); }); + + it("collects operation information for private endpoints", async () => { + const { program, diagnostics } = await compileAndDiagnose(` + +using Azure.Core; + +/** Contoso Resource Provider management API. */ +@armProviderNamespace +@service(#{ title: "ContosoProviderHubClient" }) +@versioned(Versions) +namespace Microsoft.ContosoProviderHub; + +/** Contoso API versions */ +enum Versions { + /** 2021-10-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + v2021_20_01_preview: "2021-10-01-preview", +} + +// For more information about the proxy vs tracked, +// see https://armwiki.azurewebsites.net/rp_onboarding/tracked_vs_proxy_resources.html?q=proxy%20resource +/** A ContosoProviderHub resource */ +model Employee is TrackedResource { + ...ResourceNameParameter; +} + +/** Employee properties */ +model EmployeeProperties { + /** Age of employee */ + age?: int32; + + /** City of employee */ + city?: string; + + /** Profile of employee */ + @encode("base64url") + profile?: bytes; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} + +/** The provisioning state of a resource. */ +@lroStatus +union ProvisioningState { + ResourceProvisioningState, + + /** The resource is being provisioned */ + Provisioning: "Provisioning", + + /** The resource is updating */ + Updating: "Updating", + + /** The resource is being deleted */ + Deleting: "Deleting", + + /** The resource create request has been accepted */ + Accepted: "Accepted", + + string, +} + +interface Operations extends Azure.ResourceManager.Operations {} + +model PrivateEndpointConnection is PrivateEndpointConnectionResource; +alias PrivateEndpointOperations = PrivateEndpoints; + +@armResourceOperations +interface Employees { + get is ArmResourceRead; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + update is ArmCustomPatchSync< + Employee, + Azure.ResourceManager.Foundations.ResourceUpdateModel + >; + delete is ArmResourceDeleteSync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; + /** A sample resource action that move employee to different location */ + move is ArmResourceActionSync; + + /** A sample HEAD operation to check resource existence */ + checkExistence is ArmResourceCheckExistence; + + getPrivateEndpointConnection is PrivateEndpointOperations.Read; + createOrUpdatePrivateEndpointConnection is PrivateEndpointOperations.CreateOrUpdateAsync; + updatePrivateEndpointConnection is PrivateEndpointOperations.CustomPatchAsync; + deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync; + listPrivateEndpointConnections is PrivateEndpointOperations.ListByParent; +} + +/** Employee move request */ +model MoveRequest { + /** The moving from location */ + from: string; + + /** The moving to location */ + to: string; +} + +/** Employee move response */ +model MoveResponse { + /** The status of the move */ + movingStatus: string; +} + +@armResourceOperations +interface Dependents { + get is ArmResourceRead; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + update is ArmCustomPatchSync< + Dependent, + Azure.ResourceManager.Foundations.ResourceUpdateModel + >; + delete is ArmResourceDeleteSync; + list is ArmResourceListByParent; + getPrivateEndpointConnection is PrivateEndpointOperations.Read; + createOrUpdatePrivateEndpointConnection is PrivateEndpointOperations.CreateOrUpdateAsync; + updatePrivateEndpointConnection is PrivateEndpointOperations.CustomPatchAsync; + deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync; + listPrivateEndpointConnections is PrivateEndpointOperations.ListByParent; +} + +/** An employee dependent */ +@parentResource(Employee) +model Dependent is ProxyResource { + ...ResourceNameParameter; +} + +/** Dependent properties */ +model DependentProperties { + /** Age of dependent */ + age: int32; + + /** Gender of dependent */ + gender: string; + + /** The status of the last operation. */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} +`); + expectDiagnosticEmpty(diagnostics); + const resources = resolveArmResources(program); + expect(resources).toBeDefined(); + expect(resources.resources).toBeDefined(); + expect(resources.resources).toHaveLength(3); + ok(resources.resources); + const employee = resources.resources[0]; + ok(employee); + expect(employee).toMatchObject({ + kind: "Tracked", + providerNamespace: "Microsoft.ContosoProviderHub", + type: expect.anything(), + operations: expect.any(Array), + }); + ok(employee.operations); + const subscriptionScope = employee.operations[0]; + ok(subscriptionScope); + checkResolvedOperations(subscriptionScope, { + operations: { + lifecycle: {}, + lists: [{ operationGroup: "Employees", name: "listBySubscription", kind: "list" }], + }, + resourceType: { + provider: "Microsoft.ContosoProviderHub", + types: ["employees"], + }, + resourceInstancePath: + "/subscriptions/{subscriptionId}/providers/Microsoft.ContosoProviderHub/employees/{name}", + }); + + const mainScope = employee.operations[1]; + ok(mainScope); + checkResolvedOperations(mainScope, { + operations: { + lifecycle: { + createOrUpdate: [ + { operationGroup: "Employees", name: "createOrUpdate", kind: "createOrUpdate" }, + ], + delete: [{ operationGroup: "Employees", name: "delete", kind: "delete" }], + read: [{ operationGroup: "Employees", name: "get", kind: "read" }], + update: [{ operationGroup: "Employees", name: "update", kind: "update" }], + }, + actions: [{ operationGroup: "Employees", name: "move", kind: "action" }], + lists: [{ operationGroup: "Employees", name: "listByResourceGroup", kind: "list" }], + }, + resourceType: { + provider: "Microsoft.ContosoProviderHub", + types: ["employees"], + }, + resourceInstancePath: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}", + }); + + const dependent = resources.resources[2]; + ok(dependent); + expect(dependent).toMatchObject({ + kind: "Proxy", + providerNamespace: "Microsoft.ContosoProviderHub", + type: expect.anything(), + operations: expect.any(Array), + }); + ok(dependent.operations); + expect(dependent.operations).toHaveLength(1); + const instanceScope = dependent.operations[0]; + ok(instanceScope); + checkResolvedOperations(instanceScope, { + operations: { + lifecycle: { + createOrUpdate: [ + { operationGroup: "Dependents", name: "createOrUpdate", kind: "createOrUpdate" }, + ], + delete: [{ operationGroup: "Dependents", name: "delete", kind: "delete" }], + read: [{ operationGroup: "Dependents", name: "get", kind: "read" }], + update: [{ operationGroup: "Dependents", name: "update", kind: "update" }], + }, + lists: [{ operationGroup: "Dependents", name: "list", kind: "list" }], + }, + resourceType: { + provider: "Microsoft.ContosoProviderHub", + types: ["employees", "dependents"], + }, + resourceInstancePath: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents/{dependentName}", + }); + + const privateEndpointConnection = resources.resources[1]; + ok(privateEndpointConnection); + ok(privateEndpointConnection.operations); + expect(privateEndpointConnection.operations).toHaveLength(2); + const privateForEmplInstance = privateEndpointConnection.operations[0]; + ok(privateForEmplInstance); + checkResolvedOperations(privateForEmplInstance, { + operations: { + lifecycle: { + createOrUpdate: [ + { + operationGroup: "Employees", + name: "createOrUpdatePrivateEndpointConnection", + kind: "createOrUpdate", + }, + ], + delete: [ + { + operationGroup: "Employees", + name: "deletePrivateEndpointConnection", + kind: "delete", + }, + ], + read: [ + { operationGroup: "Employees", name: "getPrivateEndpointConnection", kind: "read" }, + ], + update: [ + { + operationGroup: "Employees", + name: "updatePrivateEndpointConnection", + kind: "update", + }, + ], + }, + lists: [ + { operationGroup: "Employees", name: "listPrivateEndpointConnections", kind: "list" }, + ], + }, + resourceType: { + provider: "Microsoft.ContosoProviderHub", + types: ["employees", "privateEndpointConnections"], + }, + resourceInstancePath: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/privateEndpointConnections/{privateEndpointConnectionName}", + }); + + const privateForDepInstance = privateEndpointConnection.operations[1]; + ok(privateForDepInstance); + + checkResolvedOperations(privateForDepInstance, { + operations: { + lifecycle: { + createOrUpdate: [ + { + operationGroup: "Dependents", + name: "createOrUpdatePrivateEndpointConnection", + kind: "createOrUpdate", + }, + ], + delete: [ + { + operationGroup: "Dependents", + name: "deletePrivateEndpointConnection", + kind: "delete", + }, + ], + read: [ + { operationGroup: "Dependents", name: "getPrivateEndpointConnection", kind: "read" }, + ], + update: [ + { + operationGroup: "Dependents", + name: "updatePrivateEndpointConnection", + kind: "update", + }, + ], + }, + lists: [ + { operationGroup: "Dependents", name: "listPrivateEndpointConnections", kind: "list" }, + ], + }, + resourceType: { + provider: "Microsoft.ContosoProviderHub", + types: ["employees", "dependents", "privateEndpointConnections"], + }, + resourceInstancePath: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContosoProviderHub/employees/{employeeName}/dependents/{dependentName}/privateEndpointConnections/{privateEndpointConnectionName}", + }); + + checkArmOperationsHas(resources.unassociatedOperations, [ + { operationGroup: "Employees", name: "checkExistence", kind: "other" }, + { operationGroup: "Operations", name: "list", kind: "other" }, + ]); + }); }); diff --git a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/data-types.md b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/data-types.md index 9aed97a30b..f4497c800d 100644 --- a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/data-types.md +++ b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/data-types.md @@ -840,6 +840,55 @@ model Azure.ResourceManager.ParentKeysOf None +### `PrivateEndpointConnectionResource` {#Azure.ResourceManager.PrivateEndpointConnectionResource} + +A private endpoint connection resource. +Resource providers must declare a private endpoint connection resource type in their provider namespace if +they support private endpoint connections + +```typespec +model Azure.ResourceManager.PrivateEndpointConnectionResource +``` + +#### Template Parameters + +| Name | Description | +| ----------- | ------------------------------------------------------------------------------------------------- | +| Description | Optional. The documentary description of the private endpoint connection resource name parameter. | + +#### Examples + +```ts +namespace Microsoft.Contoso; +model PrivateEndpointConnection is PrivateEndpointConnectionResource {} +alias EmployeeConnectionOps is PrivateEndpoints; +@armResourceOperations +interface Employees { + @doc("get a private endpoint connection for resource employee") + getPrivateEndpointConnection is EmployeeConnectionOps.Read; +} +``` + +#### Properties + +| Name | Type | Description | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ | +| properties? | [`PrivateEndpointConnectionProperties`](./data-types.md#Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties) | The private endpoint connection properties | + +### `PrivateEndpointConnectionUpdate` {#Azure.ResourceManager.PrivateEndpointConnectionUpdate} + +PATCH model for private endpoint connections + +```typespec +model Azure.ResourceManager.PrivateEndpointConnectionUpdate +``` + +#### Properties + +| Name | Type | Description | +| ----------- | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------ | +| properties? | `OptionalProperties>` | The private endpoint connection properties | + ### `ProviderNamespace` {#Azure.ResourceManager.ProviderNamespace} Model describing the provider namespace. diff --git a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/decorators.md b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/decorators.md index 1518b386c5..9da665a3b7 100644 --- a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/decorators.md +++ b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/decorators.md @@ -257,9 +257,9 @@ Azure.ResourceManager common types. #### Parameters -| Name | Type | Description | -| -------- | ---------------- | ----------- | -| provider | `valueof string` | | +| Name | Type | Description | +| -------- | ---------------- | ------------------------------------------------------------------- | +| provider | `valueof string` | Optional. The resource provider namespace for the virtual resource. | ### `@extensionResource` {#@Azure.ResourceManager.extensionResource} @@ -346,9 +346,9 @@ This decorator sets the base type of the given resource. #### Parameters -| Name | Type | Description | -| ---------- | ---------------------------------------------------------------------------- | ----------- | -| baseTypeIt | `"Tenant" \| "Subscription" \| "ResourceGroup" \| "Location" \| "Extension"` | | +| Name | Type | Description | +| ---------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| baseTypeIt | `"Tenant" \| "Subscription" \| "ResourceGroup" \| "Location" \| "Extension"` | The built-in parent of the resource, this can be "Tenant", "Subscription", "ResourceGroup", "Location", or "Extension" | ### `@resourceGroupResource` {#@Azure.ResourceManager.resourceGroupResource} diff --git a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/index.mdx b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/index.mdx index c396281a69..120d02fb24 100644 --- a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/index.mdx +++ b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/index.mdx @@ -63,6 +63,7 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ExtensionResourceInstanceOperations`](./interfaces.md#Azure.ResourceManager.ExtensionResourceInstanceOperations) - [`ExtensionResourceOperations`](./interfaces.md#Azure.ResourceManager.ExtensionResourceOperations) - [`Operations`](./interfaces.md#Azure.ResourceManager.Operations) +- [`PrivateEndpoints`](./interfaces.md#Azure.ResourceManager.PrivateEndpoints) - [`ProxyResourceOperations`](./interfaces.md#Azure.ResourceManager.ProxyResourceOperations) - [`ResourceCollectionOperations`](./interfaces.md#Azure.ResourceManager.ResourceCollectionOperations) - [`ResourceCreateAsync`](./interfaces.md#Azure.ResourceManager.ResourceCreateAsync) @@ -148,6 +149,8 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`ManagedServiceIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedServiceIdentityProperty) - [`ManagedSystemAssignedIdentityProperty`](./data-types.md#Azure.ResourceManager.ManagedSystemAssignedIdentityProperty) - [`ParentKeysOf`](./data-types.md#Azure.ResourceManager.ParentKeysOf) +- [`PrivateEndpointConnectionResource`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionResource) +- [`PrivateEndpointConnectionUpdate`](./data-types.md#Azure.ResourceManager.PrivateEndpointConnectionUpdate) - [`ProviderNamespace`](./data-types.md#Azure.ResourceManager.ProviderNamespace) - [`ProxyResource`](./data-types.md#Azure.ResourceManager.ProxyResource) - [`ResourceGroupLocationResource`](./data-types.md#Azure.ResourceManager.ResourceGroupLocationResource) @@ -329,6 +332,7 @@ npm install --save-peer @azure-tools/typespec-azure-resource-manager - [`CreateOrUpdateSync`](./interfaces.md#Azure.ResourceManager.Legacy.CreateOrUpdateSync) - [`CustomPatchAsync`](./interfaces.md#Azure.ResourceManager.Legacy.CustomPatchAsync) - [`CustomPatchSync`](./interfaces.md#Azure.ResourceManager.Legacy.CustomPatchSync) +- [`ListSinglePageByParent`](./interfaces.md#Azure.ResourceManager.Legacy.ListSinglePageByParent) - [`UpdateOperation`](./interfaces.md#Azure.ResourceManager.Legacy.UpdateOperation) ### Models diff --git a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/interfaces.md b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/interfaces.md index 3a77b55bf7..9731d7ef82 100644 --- a/website/src/content/docs/docs/libraries/azure-resource-manager/reference/interfaces.md +++ b/website/src/content/docs/docs/libraries/azure-resource-manager/reference/interfaces.md @@ -121,12 +121,215 @@ interface Azure.ResourceManager.Operations<> #### `Operations.list` {#Azure.ResourceManager.Operations.list} -List the operations for the provider - ```typespec op Azure.ResourceManager.Operations.list(apiVersion: string, provider: "Microsoft.ThisWillBeReplaced"): Azure.ResourceManager.ArmResponse | Azure.ResourceManager.CommonTypes.ErrorResponse ``` +### `PrivateEndpoints` {#Azure.ResourceManager.PrivateEndpoints} + +Operations over private endpoint connection resources. + +```typespec +interface Azure.ResourceManager.PrivateEndpoints +``` + +#### Template Parameters + +| Name | Description | +| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| PrivateEndpointResource | The type of the private endpoint connection resource. You must declare a private endpoint connection resource type in your provider namespace. | + +#### `PrivateEndpoints.ListByParent` {#Azure.ResourceManager.PrivateEndpoints.ListByParent} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.ListByParent(provider: "Microsoft.ThisWillBeReplaced"): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | Optional. The PrivateEndpointConnection resource being listed | +| BaseParameters | Optional. Allows overriding the operation parameters | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the list operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.Read` {#Azure.ResourceManager.PrivateEndpoints.Read} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.Read(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | --------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | the PrivateEndpointConnection resource being read | +| BaseParameters | Optional. Allows overriding the operation parameters | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the read operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.CreateOrUpdateAsync` {#Azure.ResourceManager.PrivateEndpoints.CreateOrUpdateAsync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.CreateOrUpdateAsync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string, resource: Resource): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ----------------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | the PrivateEndpointConnection resource being created or updated | +| BaseParameters | Optional. Allows overriding the operation parameters | +| LroHeaders | Optional. Allows overriding the lro headers returned on resource create | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the createOrUpdate operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.CreateOrReplaceSync` {#Azure.ResourceManager.PrivateEndpoints.CreateOrReplaceSync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.CreateOrReplaceSync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string, resource: Resource): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | --------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | the PrivateEndpointConnection resource being created or updated | +| BaseParameters | Optional. Allows overriding the operation parameters | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the createOrUpdate operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.CreateOrReplaceAsync` {#Azure.ResourceManager.PrivateEndpoints.CreateOrReplaceAsync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.CreateOrReplaceAsync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string, resource: Resource): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ----------------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | the PrivateEndpointConnection resource being created or updated | +| BaseParameters | Optional. Allows overriding the operation parameters | +| LroHeaders | Optional. Allows overriding the lro headers returned on resource create | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the createOrReplace operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.CustomPatchAsync` {#Azure.ResourceManager.PrivateEndpoints.CustomPatchAsync} + +A long-running resource update using a custom PATCH payload (Asynchronous) to update a PrivateEndpointConnection to a resource. + +```typespec +op Azure.ResourceManager.PrivateEndpoints.CustomPatchAsync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string, properties: PatchModel): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ----------------------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | the PrivateEndpointConnection resource being updated | +| PatchModel | The input model for the PATCH request | +| BaseParameters | Optional. Allows overriding the operation parameters | +| LroHeaders | Optional. Allows overriding the lro headers returned in the Accepted response | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the patch operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.CustomPatchSync` {#Azure.ResourceManager.PrivateEndpoints.CustomPatchSync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.CustomPatchSync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string, properties: PatchModel): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | -------------------------------------------------------------- | +| ParentResource | The parent resource of the PrivateEndpointConnection | +| Resource | Optional. The PrivateEndpointConnection resource being patched | +| PatchModel | The input model for the PATCH request | +| BaseParameters | Optional. Allows overriding the operation parameters | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the patch operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.DeleteAsync` {#Azure.ResourceManager.PrivateEndpoints.DeleteAsync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.DeleteAsync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ------------------------------------------------------------------------- | +| ParentResource | The parent resource of the PrivateEndpointConnection | +| Resource | Optional. The PrivateEndpointConnection resource being deleted | +| BaseParameters | Optional. Allows overriding the parameters for the operation | +| LroHeaders | Optional. Allows overriding the headers returned in the Accepted response | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response(s) for the delete operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.DeleteSync` {#Azure.ResourceManager.PrivateEndpoints.DeleteSync} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.DeleteSync(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | ------------------------------------------------------------ | +| ParentResource | The parent resource of the PrivateEndpointConnection | +| Resource | The PrivateEndpointConnection resource being deleted | +| BaseParameters | Optional. Allows overriding the parameters for the operation | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response(s) for the delete operation | +| Error | Optional. The error response, if non-standard. | + +#### `PrivateEndpoints.DeleteAsyncBase` {#Azure.ResourceManager.PrivateEndpoints.DeleteAsyncBase} + +```typespec +op Azure.ResourceManager.PrivateEndpoints.DeleteAsyncBase(provider: "Microsoft.ThisWillBeReplaced", privateEndpointConnectionName: string): Response | Error +``` + +##### Template Parameters + +| Name | Description | +| -------------- | -------------------------------------------------------------- | +| ParentResource | The parent resource of the PrivateEndpointConnection | +| Response | The response type for the operation | +| Resource | Optional. The PrivateEndpointConnection resource being deleted | +| BaseParameters | Optional. Allows overriding the parameters for the operation | +| Parameters | Optional. Additional parameters after the path parameters | +| Error | Optional. The error response, if non-standard. | + +#### Examples + +```ts +namespace Microsoft.Contoso; +model PrivateEndpointConnection is PrivateEndpointConnectionResource {} +alias EmployeeConnectionOps is PrivateEndpoints; +@armResourceOperations +interface Employees { + @doc("get a private endpoint connection for resource employee") + getPrivateEndpointConnection is EmployeeConnectionOps.Read; +} +``` + ### `ProxyResourceOperations` {#Azure.ResourceManager.ProxyResourceOperations} A composite interface for Proxy resources that include `ResourceInstanceOperations` @@ -2102,13 +2305,13 @@ op Azure.ResourceManager.Legacy.CreateOperation(resource: BodyParameter): Respon #### Template Parameters -| Name | Description | -| ------------------- | ----------------------------------------------- | -| HttpParameters | The parameter object for the operation. | -| BodyParameter | The body parameter | -| Response | The response or union of responses for success. | -| ErrorResponse | The error response. | -| OptionalRequestBody | | +| Name | Description | +| ------------------- | -------------------------------------------------------- | +| HttpParameters | The parameter object for the operation. | +| BodyParameter | The body parameter | +| Response | The response or union of responses for success. | +| ErrorResponse | The error response. | +| OptionalRequestBody | Optional. Indicates whether the request body is optional | ### `CreateOrUpdateAsync` {#Azure.ResourceManager.Legacy.CreateOrUpdateAsync} @@ -2192,6 +2395,23 @@ op Azure.ResourceManager.Legacy.CustomPatchSync(provider: "Microsoft.ThisWillBeR | Error | Optional. The error response, if non-standard. | | OptionalRequestBody | Optional. Indicates whether the request body is optional | +### `ListSinglePageByParent` {#Azure.ResourceManager.Legacy.ListSinglePageByParent} + +```typespec +op Azure.ResourceManager.Legacy.ListSinglePageByParent(provider: "Microsoft.ThisWillBeReplaced"): Response | Error +``` + +#### Template Parameters + +| Name | Description | +| -------------- | ------------------------------------------------------------- | +| ParentResource | the parent resource of the PrivateEndpointConnection | +| Resource | Optional. The PrivateEndpointConnection resource being listed | +| BaseParameters | Optional. Allows overriding the operation parameters | +| Parameters | Optional. Additional parameters after the path parameters | +| Response | Optional. The success response for the list operation | +| Error | Optional. The error response, if non-standard. | + ### `UpdateOperation` {#Azure.ResourceManager.Legacy.UpdateOperation} ```typespec