Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TypeSpec for DeviceRegistry #29319

Merged
merged 13 commits into from
Jun 11, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ interface AssetEndpointProfiles {

createOrReplace is ArmResourceCreateOrReplaceAsync<AssetEndpointProfile>;

update is ArmResourcePatchAsync<
AssetEndpointProfile,
AssetEndpointProfileProperties
>;
@parameterVisibility
update is ArmCustomPatchAsync<AssetEndpointProfile, AssetEndpointProfile>;

delete is ArmResourceDeleteWithoutOkAsync<AssetEndpointProfile>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ModuleCR.metadata.namespace>/<ModuleCR.metadata.name>.")
@visibility("read", "create")
assetEndpointProfileUri: string;
assetEndpointProfileUri: url;

@doc("An integer that is incremented each time the resource is modified.")
@visibility("read")
Expand All @@ -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
Expand All @@ -82,7 +82,7 @@ model AssetProperties {
softwareRevision?: string;

@doc("Reference to the documentation.")
documentationUri?: string;
documentationUri?: url;

@doc("Asset serial number.")
serialNumber?: string;
Expand Down Expand Up @@ -207,7 +207,8 @@ interface Assets {

createOrReplace is ArmResourceCreateOrReplaceAsync<Asset>;

update is ArmResourcePatchAsync<Asset, AssetProperties>;
@parameterVisibility
update is ArmCustomPatchAsync<Asset, Asset>;

delete is ArmResourceDeleteWithoutOkAsync<Asset>;

Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading