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

Microsoft.Chaos Fix follow-up for TypeSpec migration #32093

Closed
wants to merge 18 commits into from
Closed
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
7 changes: 1 addition & 6 deletions specification/chaos/Chaos.Management/capability.models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ alias CapabilityParentResourceParameters = BaseParameters<Capability> &
/**
* Model that represents the Capability properties model.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Unused for this resource."
model CapabilityProperties {
/**
* String of the Publisher that this Capability extends.
Expand Down Expand Up @@ -63,12 +64,6 @@ model CapabilityProperties {
@visibility("read")
@maxLength(2048)
urn?: string;

/**
* Resource provisioning state. Not currently in use because resource is created synchronously.
*/
@visibility("read")
provisioningState?: ProvisioningState;
}

/**
Expand Down
19 changes: 17 additions & 2 deletions specification/chaos/Chaos.Management/capabilityType.models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,36 @@ using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using Azure.Core;

namespace Microsoft.Chaos;

/**
* Model that represents a Capability Type resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "Required implementation to avoid breaking .NET SDK changes"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "Required implementation to avoid breaking .NET SDK changes"
@parentResource(TargetType)
model CapabilityType
is Azure.ResourceManager.ProxyResource<CapabilityTypeProperties> {
@includeInapplicableMetadataInPayload(false)
model CapabilityType extends Azure.ResourceManager.Foundations.ProxyResource {
...ResourceNameParameter<
Resource = CapabilityType,
KeyName = "capabilityTypeName",
SegmentName = "capabilityTypes",
NamePattern = "^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$"
>;

/**
* Azure resource location.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Required to avoid SDK breaking change."
location?: azureLocation;

/**
* Capability type properties.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Required to avoid SDK breaking change."
properties?: CapabilityTypeProperties;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion specification/chaos/Chaos.Management/experiment.models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ model CustomerDataStorageProperties {
* Describes an experiment update.
*/
model ExperimentUpdate {
...Azure.ResourceManager.Foundations.TagsUpdateModel<Experiment>;
...Azure.ResourceManager.ManagedServiceIdentityProperty;
...Azure.ResourceManager.Foundations.TagsUpdateModel<Experiment>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ model ExperimentExecution
/**
* Model that represents the execution properties of an Experiment.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Unused for this resource."
model ExperimentExecutionProperties {
/**
* The status of the execution.
Expand All @@ -47,12 +48,6 @@ model ExperimentExecutionProperties {
*/
@visibility("read")
stoppedAt?: utcDateTime;

/**
* Resource provisioning state. Not currently in use for executions.
*/
@visibility("read")
provisioningState?: ProvisioningState;
}

/**
Expand Down Expand Up @@ -107,12 +102,6 @@ model ExperimentExecutionDetailsProperties {
@visibility("read")
stoppedAt?: utcDateTime;

/**
* Resource provisioning state. Not currently in use for executions.
*/
@visibility("read")
provisioningState?: ProvisioningState;

/**
* The reason why the execution failed.
*/
Expand Down
20 changes: 18 additions & 2 deletions specification/chaos/Chaos.Management/targetType.models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,38 @@ using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using Azure.Core;

namespace Microsoft.Chaos;

/**
* Model that represents a Target Type resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "Required implementation to avoid breaking .NET SDK changes"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "Required implementation to avoid breaking .NET SDK changes"
@subscriptionResource
@parentResource(SubscriptionLocationResource)
model TargetType
is Azure.ResourceManager.ProxyResource<TargetTypeProperties, false> {
@Azure.ResourceManager.Private.armResourceInternal(TargetTypeProperties)
@includeInapplicableMetadataInPayload(false)
model TargetType extends Azure.ResourceManager.Foundations.ProxyResource {
...ResourceNameParameter<
Resource = TargetType,
KeyName = "targetTypeName",
SegmentName = "targetTypes",
NamePattern = "^[a-zA-Z0-9_\\-\\.]+$"
>;

/**
* Azure resource location.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Required to avoid SDK breaking change."
location?: azureLocation;

/**
* Target type properties.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Required to avoid SDK breaking change."
properties: TargetTypeProperties;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2390,18 +2390,17 @@
"description": "String of the URN for this Capability Type.",
"maxLength": 2048,
"readOnly": true
},
"provisioningState": {
"$ref": "#/definitions/ProvisioningState",
"description": "Resource provisioning state. Not currently in use because resource is created synchronously.",
"readOnly": true
}
}
},
"CapabilityType": {
"type": "object",
"description": "Model that represents a Capability Type resource.",
"properties": {
"location": {
"$ref": "#/definitions/Azure.Core.azureLocation",
"description": "Azure resource location."
},
"properties": {
"$ref": "#/definitions/CapabilityTypeProperties",
"description": "The properties of the capability type resource.",
Expand Down Expand Up @@ -2946,7 +2945,8 @@
"properties": {
"$ref": "#/definitions/ExperimentExecutionDetailsProperties",
"description": "The properties of the experiment execution details.",
"readOnly": true
"readOnly": true,
"x-ms-client-flatten": true
}
}
},
Expand All @@ -2971,11 +2971,6 @@
"description": "String that represents the stop date time.",
"readOnly": true
},
"provisioningState": {
"$ref": "#/definitions/ProvisioningState",
"description": "Resource provisioning state. Not currently in use for executions.",
"readOnly": true
},
"failureReason": {
"type": "string",
"description": "The reason why the execution failed.",
Expand Down Expand Up @@ -3052,11 +3047,6 @@
"format": "date-time",
"description": "String that represents the stop date time.",
"readOnly": true
},
"provisioningState": {
"$ref": "#/definitions/ProvisioningState",
"description": "Resource provisioning state. Not currently in use for executions.",
"readOnly": true
}
}
},
Expand Down Expand Up @@ -3121,16 +3111,16 @@
"type": "object",
"description": "Describes an experiment update.",
"properties": {
"identity": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity",
"description": "The managed service identities assigned to this resource."
},
"tags": {
"type": "object",
"description": "Resource tags.",
"additionalProperties": {
"type": "string"
}
},
"identity": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/ManagedServiceIdentity",
"description": "The managed service identities assigned to this resource."
}
}
},
Expand Down Expand Up @@ -3657,6 +3647,10 @@
"type": "object",
"description": "Model that represents a Target Type resource.",
"properties": {
"location": {
"$ref": "#/definitions/Azure.Core.azureLocation",
"description": "Azure resource location."
},
"properties": {
"$ref": "#/definitions/TargetTypeProperties",
"description": "The properties of the target type resource.",
Expand Down
32 changes: 32 additions & 0 deletions specification/chaos/resource-manager/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ These settings apply only when `--tag=package-preview-2024-11` is specified on t
input-file:
- Microsoft.Chaos/preview/2024-11-01-preview/openapi.json
suppressions:
- code: PathForTrackedResourceTypes
from: openapi.json
where: $.paths["/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}"]
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: PathForTrackedResourceTypes
from: openapi.json
where: $.paths["/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}"]
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: AllTrackedResourcesMustHaveDelete
from: openapi.json
where: $.definitions.TargetType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: AllTrackedResourcesMustHaveDelete
from: openapi.json
where: $.definitions.CapabilityType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: TrackedResourcePatchOperation
from: openapi.json
where: $.definitions.TargetType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: TrackedResourcePatchOperation
from: openapi.json
where: $.definitions.CapabilityType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: TrackedResourcesMustHavePut
from: openapi.json
where: $.definitions.TargetType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: TrackedResourcesMustHavePut
from: openapi.json
where: $.definitions.CapabilityType
reason: Not actually a tracked resource, but location property is required to avoid breaking changes
- code: TrackedExtensionResourcesAreNotAllowed
from: openapi.json
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"].get
Expand Down
Loading