Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions eng/scripts/sync-common-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ const versions = ["v3", "v4", "v5", "v6"];
for (const version of versions) {
console.group("Syncing version:", pc.cyan(version));
const githubApiUrl = `https://api.github.com/repos/Azure/azure-rest-api-specs/contents/specification/common-types/resource-management/${version}`;
const localDir = `packages/samples/common-types/existing/${version}`;
const localDirs = [
`packages/samples/common-types/existing/${version}`,
`packages/samples/specs/resource-manager/common-types/${version}`,
];

console.log("Downloading common types:", {
version,
githubApiUrl,
localDir,
localDirs,
});

// Create the local directory if it doesn't exist
if (!existsSync(localDir)) {
mkdirSync(localDir, { recursive: true });
// Create the local directories if they don't exist
for (const localDir of localDirs) {
if (!existsSync(localDir)) {
mkdirSync(localDir, { recursive: true });
}
}

// Fetch the directory listing from GitHub API
Expand All @@ -42,15 +47,15 @@ for (const version of versions) {
// Download each file
for (const fileEntry of fileEntries) {
const remoteUrl = fileEntry.download_url;
const localPath = join(localDir, fileEntry.name);

const name = `${version}/${fileEntry.name}`;
console.log(`${pc.gray("-")} Downloading ${pc.cyan(name)}...`);

const fileRes = await fetch(remoteUrl);
if (fileRes.ok) {
const content = await fileRes.text();
writeFileSync(localPath, content);
for (const localDir of localDirs) {
writeFileSync(join(localDir, fileEntry.name), content);
}
console.log(`${pc.green("✓")} Downloaded ${pc.cyan(name)}`);
} else {
throw new Error(`Failed to download ${fileEntry.name}: ${fileRes.statusText}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.LibraryTest;
/** ARM Library API versions */
enum Versions {
/** 2021-09-21-preview version */
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v6)
@Azure.Core.previewVersion
`2021-09-21-preview`,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"swagger": "2.0",
"info": {
"title": "Common types",
"version": "3.0"
},
"paths": {},
"definitions": {
"ManagedServiceIdentity": {
"type": "object",
"description": "Managed service identity (system assigned and/or user assigned identities)",
"properties": {
"principalId": {
"type": "string",
"format": "uuid",
"description": "The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.",
"readOnly": true
},
"tenantId": {
"type": "string",
"format": "uuid",
"description": "The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.",
"readOnly": true
},
"type": {
"$ref": "#/definitions/ManagedServiceIdentityType"
},
"userAssignedIdentities": {
"$ref": "#/definitions/UserAssignedIdentities"
}
},
"required": [
"type"
]
},
"ManagedServiceIdentityType": {
"type": "string",
"description": "Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).",
"enum": [
"None",
"SystemAssigned",
"UserAssigned",
"SystemAssigned,UserAssigned"
],
"x-ms-enum": {
"name": "ManagedServiceIdentityType",
"modelAsString": true
}
},
"SystemAssignedServiceIdentity": {
"type": "object",
"description": "Managed service identity (either system assigned, or none)",
"properties": {
"principalId": {
"type": "string",
"format": "uuid",
"description": "The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.",
"readOnly": true
},
"tenantId": {
"type": "string",
"format": "uuid",
"description": "The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.",
"readOnly": true
},
"type": {
"$ref": "#/definitions/SystemAssignedServiceIdentityType"
}
},
"required": [
"type"
]
},
"SystemAssignedServiceIdentityType": {
"type": "string",
"description": "Type of managed service identity (either system assigned, or none).",
"enum": [
"None",
"SystemAssigned"
],
"x-ms-enum": {
"name": "SystemAssignedServiceIdentityType",
"modelAsString": true
}
},
"UserAssignedIdentities": {
"type": "object",
"x-nullable": true,
"title": "User-Assigned Identities",
"description": "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.",
"additionalProperties": {
"$ref": "#/definitions/UserAssignedIdentity"
}
},
"UserAssignedIdentity": {
"type": "object",
"description": "User assigned identity properties",
"properties": {
"principalId": {
"type": "string",
"format": "uuid",
"description": "The principal ID of the assigned identity.",
"readOnly": true
},
"clientId": {
"type": "string",
"format": "uuid",
"description": "The client ID of the assigned identity.",
"readOnly": true
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
{
"swagger": "2.0",
"info": {
"title": "Common types",
"version": "3.0"
},
"paths": {},
"definitions": {
"PrivateEndpoint": {
"type": "object",
"description": "The Private Endpoint resource.",
"properties": {
"id": {
"type": "string",
"description": "The ARM identifier for Private Endpoint",
"readOnly": true
}
}
},
"PrivateEndpointConnection": {
"type": "object",
"description": "The Private Endpoint Connection resource.",
"properties": {
"properties": {
"$ref": "#/definitions/PrivateEndpointConnectionProperties",
"description": "Resource properties.",
"x-ms-client-flatten": true
}
},
"allOf": [
{
"$ref": "./types.json#/definitions/Resource"
}
]
},
"PrivateEndpointConnectionListResult": {
"type": "object",
"description": "List of private endpoint connection associated with the specified storage account",
"properties": {
"value": {
"type": "array",
"description": "Array of private endpoint connections",
"items": {
"$ref": "#/definitions/PrivateEndpointConnection"
}
}
}
},
"PrivateEndpointConnectionProperties": {
"type": "object",
"description": "Properties of the PrivateEndpointConnectProperties.",
"properties": {
"privateEndpoint": {
"$ref": "#/definitions/PrivateEndpoint",
"description": "The resource of private end point."
},
"privateLinkServiceConnectionState": {
"$ref": "#/definitions/PrivateLinkServiceConnectionState",
"description": "A collection of information about the state of the connection between service consumer and provider."
},
"provisioningState": {
"$ref": "#/definitions/PrivateEndpointConnectionProvisioningState",
"description": "The provisioning state of the private endpoint connection resource."
}
},
"required": [
"privateLinkServiceConnectionState"
]
},
"PrivateEndpointConnectionProvisioningState": {
"type": "string",
"description": "The current provisioning state.",
"enum": [
"Succeeded",
"Creating",
"Deleting",
"Failed"
],
"x-ms-enum": {
"name": "PrivateEndpointConnectionProvisioningState",
"modelAsString": true
},
"readOnly": true
},
"PrivateEndpointServiceConnectionStatus": {
"type": "string",
"description": "The private endpoint connection status.",
"enum": [
"Pending",
"Approved",
"Rejected"
],
"x-ms-enum": {
"name": "PrivateEndpointServiceConnectionStatus",
"modelAsString": true
}
},
"PrivateLinkResource": {
"type": "object",
"description": "A private link resource",
"properties": {
"properties": {
"$ref": "#/definitions/PrivateLinkResourceProperties",
"description": "Resource properties.",
"x-ms-client-flatten": true
}
},
"allOf": [
{
"$ref": "./types.json#/definitions/Resource"
}
]
},
"PrivateLinkResourceListResult": {
"type": "object",
"description": "A list of private link resources",
"properties": {
"value": {
"type": "array",
"description": "Array of private link resources",
"items": {
"$ref": "#/definitions/PrivateLinkResource"
}
}
}
},
"PrivateLinkResourceProperties": {
"type": "object",
"description": "Properties of a private link resource.",
"properties": {
"groupId": {
"type": "string",
"description": "The private link resource group id.",
"readOnly": true
},
"requiredMembers": {
"type": "array",
"description": "The private link resource required member names.",
"items": {
"type": "string"
},
"readOnly": true
},
"requiredZoneNames": {
"type": "array",
"description": "The private link resource Private link DNS zone name.",
"items": {
"type": "string"
}
}
}
},
"PrivateLinkServiceConnectionState": {
"type": "object",
"description": "A collection of information about the state of the connection between service consumer and provider.",
"properties": {
"status": {
"$ref": "#/definitions/PrivateEndpointServiceConnectionStatus",
"description": "Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service."
},
"description": {
"type": "string",
"description": "The reason for approval/rejection of the connection."
},
"actionsRequired": {
"type": "string",
"description": "A message indicating if changes on the service provider require any updates on the consumer."
}
}
}
},
"parameters": {
"PrivateEndpointConnectionName": {
"name": "privateEndpointConnectionName",
"in": "path",
"description": "The name of the private endpoint connection associated with the Azure resource",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
}
}
}
Loading
Loading