From 5f5d00fdf80e9ef1fe89b4fa9281779b68d2ae35 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Tue, 4 Jun 2024 15:51:03 +0800 Subject: [PATCH 01/10] Update TypeSpec for DeviceRegistry --- .../assetEndpointProfiles.tsp | 3 +- .../DeviceRegistry.Management/assets.tsp | 9 +- .../DeviceRegistry.Management/tspconfig.yaml | 4 + .../2023-11-01-preview/deviceregistry.json | 230 +----------------- 4 files changed, 16 insertions(+), 230 deletions(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp index d47412e98703..62090421d982 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp @@ -122,7 +122,8 @@ interface AssetEndpointProfiles { createOrReplace is ArmResourceCreateOrReplaceAsync; - update is ArmResourcePatchAsync< + @parameterVisibility + update is ArmCustomPatchAsync< AssetEndpointProfile, AssetEndpointProfileProperties >; diff --git a/specification/deviceregistry/DeviceRegistry.Management/assets.tsp b/specification/deviceregistry/DeviceRegistry.Management/assets.tsp index 155d378ccea6..92b06832cd7d 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assets.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assets.tsp @@ -56,7 +56,7 @@ model AssetProperties { @doc("A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format /.") @visibility("read", "create") - assetEndpointProfileUri: string; + assetEndpointProfileUri: url; @doc("An integer that is incremented each time the resource is modified.") @visibility("read") @@ -66,7 +66,7 @@ model AssetProperties { manufacturer?: string; @doc("Asset manufacturer URI.") - manufacturerUri?: string; + manufacturerUri?: url; @doc("Asset model name.") // `model` is a reserved keyname. Wrap in double quotes @@ -82,7 +82,7 @@ model AssetProperties { softwareRevision?: string; @doc("Reference to the documentation.") - documentationUri?: string; + documentationUri?: url; @doc("Asset serial number.") serialNumber?: string; @@ -207,7 +207,8 @@ interface Assets { createOrReplace is ArmResourceCreateOrReplaceAsync; - update is ArmResourcePatchAsync; + @parameterVisibility + update is ArmCustomPatchAsync; delete is ArmResourceDeleteWithoutOkAsync; diff --git a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml index 2eb6b856421a..e54e07821d16 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml +++ b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml @@ -17,6 +17,10 @@ options: namespace: "com.azure.resourcemanager.deviceregistry" service-name: "Device Registry" examples-directory: "examples" + "@azure-tools/typespec-csharp": + namespace: "Azure.ResourceManager.DeviceRegistry" + service-name: "Device Registry" + examples-directory: "examples" linter: extends: - "@azure-tools/typespec-azure-rulesets/resource-manager" diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json index 91e1f1a92e08..7199386a803b 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json @@ -404,7 +404,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AssetEndpointProfileUpdate" + "$ref": "#/definitions/AssetEndpointProfileProperties" } } ], @@ -713,7 +713,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AssetUpdate" + "$ref": "#/definitions/AssetProperties" } } ], @@ -939,46 +939,6 @@ "targetAddress" ] }, - "AssetEndpointProfileUpdate": { - "type": "object", - "description": "The type used for update operations of the AssetEndpointProfile.", - "properties": { - "tags": { - "type": "object", - "description": "Resource tags.", - "additionalProperties": { - "type": "string" - } - }, - "properties": { - "$ref": "#/definitions/AssetEndpointProfileUpdateProperties", - "x-ms-client-flatten": true - } - } - }, - "AssetEndpointProfileUpdateProperties": { - "type": "object", - "description": "The updatable properties of the AssetEndpointProfile.", - "properties": { - "targetAddress": { - "type": "string", - "format": "uri", - "description": "The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration." - }, - "userAuthentication": { - "$ref": "#/definitions/UserAuthenticationUpdate", - "description": "Defines the client authentication mechanism to the server." - }, - "transportAuthentication": { - "$ref": "#/definitions/TransportAuthenticationUpdate", - "description": "Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device." - }, - "additionalConfiguration": { - "type": "string", - "description": "Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF)." - } - } - }, "AssetListResult": { "type": "object", "description": "The response of a Asset list operation.", @@ -1035,6 +995,7 @@ }, "assetEndpointProfileUri": { "type": "string", + "format": "uri", "description": "A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint that provides data points for this asset. Must have the format /.", "x-ms-mutability": [ "read", @@ -1053,6 +1014,7 @@ }, "manufacturerUri": { "type": "string", + "format": "uri", "description": "Asset manufacturer URI." }, "model": { @@ -1073,6 +1035,7 @@ }, "documentationUri": { "type": "string", + "format": "uri", "description": "Reference to the documentation." }, "serialNumber": { @@ -1157,106 +1120,6 @@ } } }, - "AssetUpdate": { - "type": "object", - "description": "The type used for update operations of the Asset.", - "properties": { - "tags": { - "type": "object", - "description": "Resource tags.", - "additionalProperties": { - "type": "string" - } - }, - "properties": { - "$ref": "#/definitions/AssetUpdateProperties", - "x-ms-client-flatten": true - } - } - }, - "AssetUpdateProperties": { - "type": "object", - "description": "The updatable properties of the Asset.", - "properties": { - "assetType": { - "type": "string", - "description": "Resource path to asset type (model) definition." - }, - "enabled": { - "type": "boolean", - "description": "Enabled/Disabled status of the asset." - }, - "displayName": { - "type": "string", - "description": "Human-readable display name." - }, - "description": { - "type": "string", - "description": "Human-readable description of the asset." - }, - "manufacturer": { - "type": "string", - "description": "Asset manufacturer name." - }, - "manufacturerUri": { - "type": "string", - "description": "Asset manufacturer URI." - }, - "model": { - "type": "string", - "description": "Asset model name." - }, - "productCode": { - "type": "string", - "description": "Asset product code." - }, - "hardwareRevision": { - "type": "string", - "description": "Revision number of the hardware." - }, - "softwareRevision": { - "type": "string", - "description": "Revision number of the software." - }, - "documentationUri": { - "type": "string", - "description": "Reference to the documentation." - }, - "serialNumber": { - "type": "string", - "description": "Asset serial number." - }, - "attributes": { - "type": "object", - "description": "A set of key-value pairs that contain custom attributes set by the customer.", - "additionalProperties": {} - }, - "defaultDataPointsConfiguration": { - "type": "string", - "description": "Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol." - }, - "defaultEventsConfiguration": { - "type": "string", - "description": "Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default settings here. This assumes that each asset instance has one protocol." - }, - "dataPoints": { - "type": "array", - "description": "Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data point configuration. See below for more details for the definition of the dataPoints element.", - "items": { - "$ref": "#/definitions/DataPoint" - }, - "x-ms-identifiers": [] - }, - "events": { - "type": "array", - "description": "Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. See below for more details about the definition of the events element.", - "items": { - "$ref": "#/definitions/Event" - }, - "x-ms-identifiers": [] - } - } - }, "DataPoint": { "type": "object", "description": "Defines the data point properties.", @@ -1465,20 +1328,6 @@ "ownCertificates" ] }, - "TransportAuthenticationUpdate": { - "type": "object", - "description": "Definition of the authentication mechanism for the southbound connector.", - "properties": { - "ownCertificates": { - "type": "array", - "description": "Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector connecting to the shop floor/OT device. The accepted extensions are .der for certificates and .pfx/.pem for private keys.", - "items": { - "$ref": "#/definitions/OwnCertificate" - }, - "x-ms-identifiers": [] - } - } - }, "UserAuthentication": { "type": "object", "description": "Definition of the client authentication mechanism to the server.", @@ -1527,51 +1376,6 @@ "mode" ] }, - "UserAuthenticationUpdate": { - "type": "object", - "description": "Definition of the client authentication mechanism to the server.", - "properties": { - "mode": { - "type": "string", - "description": "Defines the mode to authenticate the user of the client at the server.", - "default": "Certificate", - "enum": [ - "Anonymous", - "Certificate", - "UsernamePassword" - ], - "x-ms-enum": { - "name": "UserAuthenticationMode", - "modelAsString": true, - "values": [ - { - "name": "Anonymous", - "value": "Anonymous", - "description": "The user authentication mode is anonymous." - }, - { - "name": "Certificate", - "value": "Certificate", - "description": "The user authentication mode is an x509 certificate." - }, - { - "name": "UsernamePassword", - "value": "UsernamePassword", - "description": "The user authentication mode is a username and password." - } - ] - } - }, - "usernamePasswordCredentials": { - "$ref": "#/definitions/UsernamePasswordCredentialsUpdate", - "description": "Defines the username and password references when UsernamePassword user authentication mode is selected." - }, - "x509Credentials": { - "$ref": "#/definitions/X509CredentialsUpdate", - "description": "Defines the certificate reference when Certificate user authentication mode is selected." - } - } - }, "UsernamePasswordCredentials": { "type": "object", "description": "The credentials for authentication mode UsernamePassword.", @@ -1590,20 +1394,6 @@ "passwordReference" ] }, - "UsernamePasswordCredentialsUpdate": { - "type": "object", - "description": "The credentials for authentication mode UsernamePassword.", - "properties": { - "usernameReference": { - "type": "string", - "description": "A reference to secret containing the username." - }, - "passwordReference": { - "type": "string", - "description": "A reference to secret containing the password." - } - } - }, "X509Credentials": { "type": "object", "description": "The x509 certificate for authentication mode Certificate.", @@ -1616,16 +1406,6 @@ "required": [ "certificateReference" ] - }, - "X509CredentialsUpdate": { - "type": "object", - "description": "The x509 certificate for authentication mode Certificate.", - "properties": { - "certificateReference": { - "type": "string", - "description": "A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx)." - } - } } }, "parameters": {} From 3aa860acf5c8fcb704af6ba0db9cbd271cbf0065 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Tue, 4 Jun 2024 16:04:53 +0800 Subject: [PATCH 02/10] add client.tsp --- .../DeviceRegistry.Management/client.tsp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 specification/deviceregistry/DeviceRegistry.Management/client.tsp diff --git a/specification/deviceregistry/DeviceRegistry.Management/client.tsp b/specification/deviceregistry/DeviceRegistry.Management/client.tsp new file mode 100644 index 000000000000..7558bc9f65f5 --- /dev/null +++ b/specification/deviceregistry/DeviceRegistry.Management/client.tsp @@ -0,0 +1,13 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; + +namespace Microsoft.DeviceRegistry; + +@@clientName(Asset, "DeviceRegistryAsset", "csharp"); +@@clientName(AssetEndpointProfile, "DeviceRegistryAssetEndpointProfile", "csharp"); +@@clientName(ExtendedLocation, "DeviceRegistryExtendedLocation", "csharp"); +@@clientName(Event, "AssetEvent", "csharp"); +@@clientName(ProvisioningState, "DeviceRegistryProvisioningState", "csharp"); +@@clientName(ExtendedLocation.type, "ExtendedLocationType", "csharp"); \ No newline at end of file From 3b4d92c1a4a57aeec9c13f32d5211bff484302b6 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Wed, 5 Jun 2024 10:36:52 +0800 Subject: [PATCH 03/10] fix model validation --- .../DeviceRegistry.Management/assetEndpointProfiles.tsp | 2 +- .../deviceregistry/DeviceRegistry.Management/assets.tsp | 2 +- .../preview/2023-11-01-preview/deviceregistry.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp index 62090421d982..018d5da78bb9 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp @@ -125,7 +125,7 @@ interface AssetEndpointProfiles { @parameterVisibility update is ArmCustomPatchAsync< AssetEndpointProfile, - AssetEndpointProfileProperties + AssetEndpointProfile >; delete is ArmResourceDeleteWithoutOkAsync; diff --git a/specification/deviceregistry/DeviceRegistry.Management/assets.tsp b/specification/deviceregistry/DeviceRegistry.Management/assets.tsp index 92b06832cd7d..6a695b570fa0 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assets.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assets.tsp @@ -208,7 +208,7 @@ interface Assets { createOrReplace is ArmResourceCreateOrReplaceAsync; @parameterVisibility - update is ArmCustomPatchAsync; + update is ArmCustomPatchAsync; delete is ArmResourceDeleteWithoutOkAsync; diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json index 7199386a803b..5991aaddadb6 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/deviceregistry.json @@ -404,7 +404,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AssetEndpointProfileProperties" + "$ref": "#/definitions/AssetEndpointProfile" } } ], @@ -713,7 +713,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AssetProperties" + "$ref": "#/definitions/Asset" } } ], From 5aad47d600d0d422a8ba3b3194979d7a9b54485f Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Thu, 6 Jun 2024 13:09:58 +0800 Subject: [PATCH 04/10] fix example --- .../preview/2023-11-01-preview/examples/Update_Asset.json | 7 ++++++- .../examples/Update_AssetEndpointProfile.json | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json index 356d96faab2a..8008a52029cc 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json @@ -10,7 +10,12 @@ "properties": { "properties": { "enabled": false, - "displayName": "NewAssetDisplayName" + "displayName": "NewAssetDisplayName", + "assetEndpointProfileUri": "https://www.example.com/myAssetEndpointProfile" + }, + "extendedLocation": { + "type": "CustomLocation", + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1" } } }, diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json index e4c17fcd8789..cf5858e02832 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json @@ -10,6 +10,10 @@ "properties": { "properties": { "targetAddress": "https://www.example.com/myTargetAddress" + }, + "extendedLocation": { + "type": "CustomLocation", + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1" } } }, From bc38e7da2821bc691b9ce9d3354fa0ae28f8f980 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Thu, 6 Jun 2024 14:36:31 +0800 Subject: [PATCH 05/10] fix example --- .../preview/2023-11-01-preview/examples/Update_Asset.json | 1 + .../2023-11-01-preview/examples/Update_AssetEndpointProfile.json | 1 + 2 files changed, 2 insertions(+) diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json index 8008a52029cc..554f1c4f70a6 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json @@ -8,6 +8,7 @@ "resourceGroupName": "myResourceGroup", "assetName": "my-asset", "properties": { + "location": "West Europe", "properties": { "enabled": false, "displayName": "NewAssetDisplayName", diff --git a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json index cf5858e02832..bc2ec7d92277 100644 --- a/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json +++ b/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json @@ -8,6 +8,7 @@ "resourceGroupName": "myResourceGroup", "assetEndpointProfileName": "my-assetendpointprofile", "properties": { + "location": "West Europe", "properties": { "targetAddress": "https://www.example.com/myTargetAddress" }, From 48198119cabc22ae68fdcb96afd7e669d9c15e23 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Fri, 7 Jun 2024 14:36:36 +0800 Subject: [PATCH 06/10] remove unused csharp option --- .../deviceregistry/DeviceRegistry.Management/tspconfig.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml index e54e07821d16..f4f36808680e 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml +++ b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml @@ -19,8 +19,6 @@ options: examples-directory: "examples" "@azure-tools/typespec-csharp": namespace: "Azure.ResourceManager.DeviceRegistry" - service-name: "Device Registry" - examples-directory: "examples" linter: extends: - "@azure-tools/typespec-azure-rulesets/resource-manager" From bec22ddbdf8e9458a59bcc9189e6f05653173918 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Fri, 7 Jun 2024 15:12:09 +0800 Subject: [PATCH 07/10] update client.tsp --- .../deviceregistry/DeviceRegistry.Management/client.tsp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/client.tsp b/specification/deviceregistry/DeviceRegistry.Management/client.tsp index 7558bc9f65f5..9e85510f5597 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/client.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/client.tsp @@ -10,4 +10,6 @@ namespace Microsoft.DeviceRegistry; @@clientName(ExtendedLocation, "DeviceRegistryExtendedLocation", "csharp"); @@clientName(Event, "AssetEvent", "csharp"); @@clientName(ProvisioningState, "DeviceRegistryProvisioningState", "csharp"); -@@clientName(ExtendedLocation.type, "ExtendedLocationType", "csharp"); \ No newline at end of file +@@clientName(ExtendedLocation.type, "ExtendedLocationType", "csharp"); +@@access(OperationStatus.get, Access.internal, "csharp"); +@@access(Operations.list, Access.internal, "csharp"); \ No newline at end of file From 883940edec8b7959c23f3cae7fe00b87bd167b6b Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Fri, 7 Jun 2024 15:24:51 +0800 Subject: [PATCH 08/10] fix tsp validation --- .../examples/2023-11-01-preview/Update_Asset.json | 8 +++++++- .../2023-11-01-preview/Update_AssetEndpointProfile.json | 5 +++++ .../DeviceRegistry.Management/tspconfig.yaml | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_Asset.json b/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_Asset.json index 356d96faab2a..554f1c4f70a6 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_Asset.json +++ b/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_Asset.json @@ -8,9 +8,15 @@ "resourceGroupName": "myResourceGroup", "assetName": "my-asset", "properties": { + "location": "West Europe", "properties": { "enabled": false, - "displayName": "NewAssetDisplayName" + "displayName": "NewAssetDisplayName", + "assetEndpointProfileUri": "https://www.example.com/myAssetEndpointProfile" + }, + "extendedLocation": { + "type": "CustomLocation", + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1" } } }, diff --git a/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_AssetEndpointProfile.json b/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_AssetEndpointProfile.json index e4c17fcd8789..bc2ec7d92277 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_AssetEndpointProfile.json +++ b/specification/deviceregistry/DeviceRegistry.Management/examples/2023-11-01-preview/Update_AssetEndpointProfile.json @@ -8,8 +8,13 @@ "resourceGroupName": "myResourceGroup", "assetEndpointProfileName": "my-assetendpointprofile", "properties": { + "location": "West Europe", "properties": { "targetAddress": "https://www.example.com/myTargetAddress" + }, + "extendedLocation": { + "type": "CustomLocation", + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1" } } }, diff --git a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml index f4f36808680e..e84395734923 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml +++ b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml @@ -19,6 +19,7 @@ options: examples-directory: "examples" "@azure-tools/typespec-csharp": namespace: "Azure.ResourceManager.DeviceRegistry" + flavor: "azure" linter: extends: - "@azure-tools/typespec-azure-rulesets/resource-manager" From 0a14bb9094167d0da1843d5d263e456e21d88e92 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Fri, 7 Jun 2024 15:33:52 +0800 Subject: [PATCH 09/10] fix more tsp validation --- .../DeviceRegistry.Management/assetEndpointProfiles.tsp | 5 +---- .../deviceregistry/DeviceRegistry.Management/client.tsp | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp index 018d5da78bb9..14b4184ba0f8 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp @@ -123,10 +123,7 @@ interface AssetEndpointProfiles { createOrReplace is ArmResourceCreateOrReplaceAsync; @parameterVisibility - update is ArmCustomPatchAsync< - AssetEndpointProfile, - AssetEndpointProfile - >; + update is ArmCustomPatchAsync; delete is ArmResourceDeleteWithoutOkAsync; diff --git a/specification/deviceregistry/DeviceRegistry.Management/client.tsp b/specification/deviceregistry/DeviceRegistry.Management/client.tsp index 9e85510f5597..d676677d0a04 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/client.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/client.tsp @@ -6,10 +6,13 @@ using Azure.ClientGenerator.Core; namespace Microsoft.DeviceRegistry; @@clientName(Asset, "DeviceRegistryAsset", "csharp"); -@@clientName(AssetEndpointProfile, "DeviceRegistryAssetEndpointProfile", "csharp"); +@@clientName(AssetEndpointProfile, + "DeviceRegistryAssetEndpointProfile", + "csharp" +); @@clientName(ExtendedLocation, "DeviceRegistryExtendedLocation", "csharp"); @@clientName(Event, "AssetEvent", "csharp"); @@clientName(ProvisioningState, "DeviceRegistryProvisioningState", "csharp"); @@clientName(ExtendedLocation.type, "ExtendedLocationType", "csharp"); @@access(OperationStatus.get, Access.internal, "csharp"); -@@access(Operations.list, Access.internal, "csharp"); \ No newline at end of file +@@access(Operations.list, Access.internal, "csharp"); From 816a954919b1503e3c318ef56e7325f4b113cdc9 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Tue, 11 Jun 2024 13:28:41 +0800 Subject: [PATCH 10/10] update csharp option --- .../deviceregistry/DeviceRegistry.Management/tspconfig.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml index e84395734923..2d9ea203974c 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml +++ b/specification/deviceregistry/DeviceRegistry.Management/tspconfig.yaml @@ -18,7 +18,8 @@ options: service-name: "Device Registry" examples-directory: "examples" "@azure-tools/typespec-csharp": - namespace: "Azure.ResourceManager.DeviceRegistry" + package-dir: "Azure.ResourceManager.DeviceRegistry" + namespace: "{package-dir}" flavor: "azure" linter: extends: