Skip to content

Commit

Permalink
fixed validation errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mlacouture committed Oct 15, 2024
1 parent 5202c9c commit b676686
Show file tree
Hide file tree
Showing 14 changed files with 234 additions and 245 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
Expand All @@ -12,15 +13,10 @@ using TypeSpec.OpenAPI;

namespace GitHub.Network;

#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
@doc("GitHub.Network networkSettings resource. Represents the network settings needed for vnet injection.")
@includeInapplicableMetadataInPayload(false)
@Azure.ResourceManager.Private.armResourceInternal(
NetworkSettingsResourceProperties
)
model NetworkSettingsResource
extends TrackedResource<NetworkSettingsResourceProperties> {
is Azure.ResourceManager.TrackedResource<NetworkSettingsResourceProperties> {
@doc("Name of the GitHub.Network resource")
@pattern("^[a-zA-Z0-9]")
@path
Expand All @@ -29,7 +25,7 @@ model NetworkSettingsResource
@visibility("read")
name: string;

...Azure.ResourceManager.ManagedServiceIdentity;
...Azure.ResourceManager.ManagedServiceIdentityProperty;
}

@armResourceOperations
Expand All @@ -46,7 +42,6 @@ interface NetworkSettingsResources {

#suppress "@azure-tools/typespec-azure-core/no-operation-id" "For backward compatibility"
@doc("Updates the properties of an existing GitHub.Network networkSettings resource with the specified update parameters.")
@parameterVisibility("read")
@operationId("networkSettings_Update")
update is ArmResourcePatchSync<
NetworkSettingsResource,
Expand All @@ -72,14 +67,17 @@ interface NetworkSettingsResources {
@@doc(NetworkSettingsResources.create::parameters.resource,
"GitHub.Network networkSettings resource create parameters."
);
@@projectedName(NetworkSettingsResources.create::parameters.resource,
"json",
@@Azure.ClientGenerator.Core.clientName(NetworkSettingsResources.create::parameters.resource,
"networkSettings"
);

@@doc(NetworkSettingsResources.update::parameters.properties,
"Parameters for updating the properties of the GitHub.Network resource."
);
@@projectedName(NetworkSettingsResources.update::parameters.properties,
"json",
@@Azure.ClientGenerator.Core.clientName(NetworkSettingsResources.update::parameters.properties,
"networkSettings"
);

@@Azure.ClientGenerator.Core.clientName(NetworkSettingsResources,
"networkSettings"
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"properties": {
"businessId": "GitHub",
"subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet"
}
},
"tags": {}
},
"networkSettingsName": "networkSettings",
"resourceGroupName": "resourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"tags": {}
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"parameters": {
"api-version": "2024-04-01",
"networkSettings": {},
"networkSettings": {
"tags": {
"tagName": "tagValue"
}
},
"networkSettingsName": "networkSettings",
"resourceGroupName": "resourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"tags": {
"tagName": "tagValue"
}
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"properties": {
"businessId": "GitHub",
"subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet"
}
},
"tags": {}
},
"networkSettingsName": "networkSettings",
"resourceGroupName": "resourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"tags": {}
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"parameters": {
"api-version": "2024-04-02",
"networkSettings": {},
"networkSettings": {
"tags": {
"tagName": "tagValue"
}
},
"networkSettingsName": "networkSettings",
"resourceGroupName": "resourceGroup",
"subscriptionId": "00000000-0000-0000-0000-000000000000",
"tags": {
"tagName": "tagValue"
}
"subscriptionId": "00000000-0000-0000-0000-000000000000"
},
"responses": {
"200": {
Expand Down
21 changes: 7 additions & 14 deletions specification/github-network/GitHub.Network.Management/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ namespace GitHub.Network;
interface Operations extends Azure.ResourceManager.Operations {}

@doc("Provisioning status of the managed application.")
enum ProvisioningState {
union ProvisioningState {
@doc("The provisioning of the resource failed.")
Failed,
Failed: "Failed",

@doc("The resource was provisioned successfully.")
Succeeded,
Succeeded: "Succeeded",

@doc("The provisioning of the resource was cancelled.")
Canceled,
Canceled: "Canceled",

@doc("The resource provisioning is in progress.")
Accepted,
Accepted: "Accepted",

string,
}

@doc("NetworkSettings resource-specific properties.")
Expand All @@ -43,15 +45,6 @@ model NetworkSettingsResourceProperties {
@visibility("read", "create")
businessId?: string;

@doc("Specifies the GitHub organization (enterprise) ID associated to the Azure subscription.")
@removed(Versions.`2024-04-01-preview`)
@visibility("read", "create")
organizationId?: string;

@doc("Specifies a comma-separated list of service names the resource is associated with.")
@removed(Versions.`2024-04-01-preview`)
targetServices?: [];

@doc("The managed application provisioning state.")
@visibility("read")
provisioningState?: ProvisioningState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ options:
emitter-output-dir: "{project-root}/.."
azure-resource-provider-folder: "resource-manager"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/GitHub.Network.json"
examples-directory: "{project-root}/examples"
examples-dir: "{project-root}/examples"
linter:
extends:
- "@azure-tools/typespec-azure-rulesets/resource-manager"
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@
"required": true,
"schema": {
"$ref": "#/definitions/NetworkSettingsResource"
},
"x-ms-client-name": "resource"
}
}
],
"responses": {
Expand Down Expand Up @@ -302,8 +301,7 @@
"required": true,
"schema": {
"$ref": "#/definitions/NetworkSettingsResourceUpdate"
},
"x-ms-client-name": "properties"
}
}
],
"responses": {
Expand Down Expand Up @@ -374,35 +372,63 @@
}
},
"definitions": {
"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityUpdate": {
"type": "object",
"description": "Managed service identity (system assigned and/or user assigned identities)",
"properties": {
"type": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentityType",
"description": "The type of managed identity assigned to this resource."
},
"userAssignedIdentities": {
"type": "object",
"description": "The identities assigned to this resource by the user.",
"additionalProperties": {
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/UserAssignedIdentity"
}
],
"type": "object",
"x-nullable": true
}
}
}
},
"Azure.ResourceManager.CommonTypes.TrackedResourceUpdate": {
"type": "object",
"description": "The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'",
"properties": {
"tags": {
"type": "object",
"description": "Resource tags.",
"additionalProperties": {
"type": "string"
}
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/Resource"
}
]
},
"NetworkSettingsResource": {
"type": "object",
"description": "GitHub.Network networkSettings resource. Represents the network settings needed for vnet injection.",
"properties": {
"properties": {
"$ref": "#/definitions/NetworkSettingsResourceProperties",
"description": "The resource-specific properties for this resource."
},
"identity": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity",
"description": "The managed service identities assigned to this resource."
}
},
"allOf": [
{
"type": "object",
"description": "Concrete tracked resource types can be created by aliasing this type using a specific property type.",
"properties": {
"properties": {
"$ref": "#/definitions/NetworkSettingsResourceProperties",
"description": "The resource-specific properties for this resource.",
"x-ms-client-flatten": true,
"x-ms-mutability": [
"read",
"create"
]
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/TrackedResource"
}
]
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/TrackedResource"
}
]
},
Expand Down Expand Up @@ -456,20 +482,22 @@
},
"NetworkSettingsResourceUpdate": {
"type": "object",
"description": "The type used for update operations of the NetworkSettingsResource.",
"description": "GitHub.Network networkSettings resource. Represents the network settings needed for vnet injection.",
"properties": {
"properties": {
"$ref": "#/definitions/NetworkSettingsResourceProperties",
"description": "The resource-specific properties for this resource."
},
"identity": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity",
"$ref": "#/definitions/Azure.ResourceManager.CommonTypes.ManagedServiceIdentityUpdate",
"description": "The managed service identities assigned to this resource."
},
"tags": {
"type": "object",
"description": "Resource tags.",
"additionalProperties": {
"type": "string"
}
}
}
},
"allOf": [
{
"$ref": "#/definitions/Azure.ResourceManager.CommonTypes.TrackedResourceUpdate"
}
]
},
"ProvisioningState": {
"type": "string",
Expand Down Expand Up @@ -507,36 +535,6 @@
]
},
"readOnly": true
},
"Versions": {
"type": "string",
"description": "The available API versions.",
"enum": [
"2024-04-01-preview",
"2024-04-01",
"2024-04-02"
],
"x-ms-enum": {
"name": "Versions",
"modelAsString": true,
"values": [
{
"name": "2024-04-01-preview",
"value": "2024-04-01-preview",
"description": "The 2024-04-01-preview API version for staging environment."
},
{
"name": "2024-04-01",
"value": "2024-04-01",
"description": "The 2024-04-01 API version for staff US environment."
},
{
"name": "2024-04-02",
"value": "2024-04-02",
"description": "The 2024-04-02 API version for production US/EU environments."
}
]
}
}
},
"parameters": {}
Expand Down
Loading

0 comments on commit b676686

Please sign in to comment.