diff --git a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp index d47412e98703..14b4184ba0f8 100644 --- a/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp +++ b/specification/deviceregistry/DeviceRegistry.Management/assetEndpointProfiles.tsp @@ -122,10 +122,8 @@ interface AssetEndpointProfiles { createOrReplace is ArmResourceCreateOrReplaceAsync; - update is ArmResourcePatchAsync< - AssetEndpointProfile, - AssetEndpointProfileProperties - >; + @parameterVisibility + update is ArmCustomPatchAsync; delete is ArmResourceDeleteWithoutOkAsync; diff --git a/specification/deviceregistry/DeviceRegistry.Management/assets.tsp b/specification/deviceregistry/DeviceRegistry.Management/assets.tsp index 155d378ccea6..6a695b570fa0 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/client.tsp b/specification/deviceregistry/DeviceRegistry.Management/client.tsp new file mode 100644 index 000000000000..d676677d0a04 --- /dev/null +++ b/specification/deviceregistry/DeviceRegistry.Management/client.tsp @@ -0,0 +1,18 @@ +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"); +@@access(OperationStatus.get, Access.internal, "csharp"); +@@access(Operations.list, Access.internal, "csharp"); 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 2eb6b856421a..2d9ea203974c 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": + package-dir: "Azure.ResourceManager.DeviceRegistry" + namespace: "{package-dir}" + flavor: "azure" 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..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/AssetEndpointProfileUpdate" + "$ref": "#/definitions/AssetEndpointProfile" } } ], @@ -713,7 +713,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AssetUpdate" + "$ref": "#/definitions/Asset" } } ], @@ -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": {} 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..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,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/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..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,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" } } },