Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import "@azure-tools/typespec-client-generator-core";
import "./privateEndpointConnection.tsp";
import "./experimentExecution.tsp";
import "./privateAccess.tsp";

using Azure.ClientGenerator.Core;
using Microsoft.Chaos;

// PrivateEndpointConnections interface operations with PrivateAccesses_ prefix
@@clientLocation(PrivateEndpointConnections.getAPrivateEndpointConnection,
PrivateAccesses,
"!csharp"
);
@@clientLocation(PrivateEndpointConnections.deleteAPrivateEndpointConnection,
PrivateAccesses,
"!csharp"
);
@@clientLocation(PrivateEndpointConnections.listPrivateEndpointConnections,
PrivateAccesses,
"!csharp"
);

// ExperimentExecutions interface operations with Experiments_ prefix
@@clientLocation(ExperimentExecutions.getExecution, Experiments, "!csharp");
@@clientLocation(ExperimentExecutions.listAllExecutions,
Experiments,
"!csharp"
);
@@clientLocation(ExperimentExecutions.getExecutionDetails,
Experiments,
"!csharp"
);

@@clientName(Operations.list, "ListAll", "autorest");
@@clientName(ExperimentExecutions.getExecutionDetails, "ExecutionDetails");
@@clientName(PrivateAccesses.privateLinkResources, "GetPrivateLinkResources");
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import "@typespec/rest";
import "@typespec/http";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "./common.models.tsp";

using TypeSpec.Rest;
using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.Chaos;

/**
* Model that represents a Capability resource.
*/
@parentResource(Target)
model Capability is Azure.ResourceManager.ProxyResource<CapabilityProperties> {
...ResourceNameParameter<
Resource = Capability,
KeyName = "capabilityName",
SegmentName = "capabilities",
NamePattern = "^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$"
>;
}

alias CapabilityParentResourceParameters = BaseParameters<Capability> &
ParentResourceParameters;

/**
* Model that represents the Capability properties model.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Unused property, avoids breaking changes in SDK."
model CapabilityProperties {
/**
* String of the Publisher that this Capability extends.
*/
@visibility(Lifecycle.Read)
publisher?: string;

/**
* String of the Target Type that this Capability extends.
*/
@visibility(Lifecycle.Read)
targetType?: string;

/**
* Localized string of the description.
*/
@visibility(Lifecycle.Read)
description?: string;

/**
* URL to retrieve JSON schema of the Capability parameters.
*/
@visibility(Lifecycle.Read)
@maxLength(2048)
parametersSchema?: string;

/**
* String of the URN for this Capability Type.
*/
@visibility(Lifecycle.Read)
@maxLength(2048)
urn?: string;

/**
* Resource provisioning state. Not currently in use because resource is created synchronously.
*/
@removed(Microsoft.Chaos.Versions.v2025_01_01)
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;
}

/**
* Model that represents a list of Capability resources and a link for pagination.
*/
model CapabilityListResult is Azure.Core.Page<Capability>;
61 changes: 61 additions & 0 deletions tests-upgrade/tests-emitter/Chaos.Management.brown/capability.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./capability.models.tsp";
import "./target.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Chaos;

@armResourceOperations
interface Capabilities {
/**
* Get a Capability resource that extends a Target resource.
*/
get is ArmResourceRead<Capability, CapabilityParentResourceParameters>;

/**
* Create or update a Capability resource that extends a Target resource.
*/
createOrUpdate is ArmResourceCreateOrReplaceSync<
Capability,
CapabilityParentResourceParameters
>;

/**
* Delete a Capability that extends a Target resource.
*/
delete is ArmResourceDeleteSync<
Capability,
CapabilityParentResourceParameters
>;

/**
* Get a list of Capability resources that extend a Target resource.
*/
list is ArmResourceListByParent<
Capability,
{
...CapabilityParentResourceParameters;

/**
* String that sets the continuation token.
*/
@query("continuationToken")
continuationToken?: string;
},
Response = CapabilityListResult
>;
}

@@doc(Capability.name, "String that represents a Capability resource name.");
@@doc(Capability.properties, "The properties of a capability resource.");
@@doc(Capabilities.createOrUpdate::parameters.resource,
"Capability resource to be created or updated."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import "@typespec/rest";
import "@typespec/http";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

using TypeSpec.Rest;
using TypeSpec.Http;
using Azure.ResourceManager;
using Azure.ResourceManager.Foundations;
using TypeSpec.OpenAPI;
using TypeSpec.Versioning;

namespace Microsoft.Chaos;

/**
* Model that represents a Capability Type resource.
*/
@parentResource(TargetType)
model CapabilityType
is Azure.ResourceManager.ProxyResource<CapabilityTypeProperties> {
...ResourceNameParameter<
Resource = CapabilityType,
KeyName = "capabilityTypeName",
SegmentName = "capabilityTypes",
NamePattern = "^[a-zA-Z0-9\\-\\.]+-\\d\\.\\d$"
>;
}

/**
* Model that represents the Capability Type properties model.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "Read-only metadata resource."
model CapabilityTypeProperties {
/**
* String of the Publisher that this Capability Type extends.
*/
@visibility(Lifecycle.Read)
publisher?: string;

/**
* String of the Target Type that this Capability Type extends.
*/
@visibility(Lifecycle.Read)
targetType?: string;

/**
* Localized string of the display name.
*/
@visibility(Lifecycle.Read)
displayName?: string;

/**
* Localized string of the description.
*/
@visibility(Lifecycle.Read)
description?: string;

/**
* URL to retrieve JSON schema of the Capability Type parameters.
*/
@visibility(Lifecycle.Read)
@maxLength(2048)
parametersSchema?: string;

/**
* String of the URN for this Capability Type.
*/
@visibility(Lifecycle.Read)
@maxLength(2048)
urn?: string;

/**
* String of the kind of this Capability Type.
*/
@visibility(Lifecycle.Read)
kind?: string;

/**
* Control plane actions necessary to execute capability type.
*/
@visibility(Lifecycle.Read)
azureRbacActions?: string[];

/**
* Data plane actions necessary to execute capability type.
*/
@visibility(Lifecycle.Read)
azureRbacDataActions?: string[];

/**
* Required Azure Role Definition Ids to execute capability type.
*/
@visibility(Lifecycle.Read)
@added(Microsoft.Chaos.Versions.v2025_01_01)
requiredAzureRoleDefinitionIds?: string[];

/**
* Runtime properties of this Capability Type.
*/
@visibility(Lifecycle.Read)
runtimeProperties?: CapabilityTypePropertiesRuntimeProperties;
}

/**
* Runtime properties of this Capability Type.
*/
model CapabilityTypePropertiesRuntimeProperties {
/**
* String of the kind of the resource's action type (continuous or discrete).
*/
@visibility(Lifecycle.Read)
kind?: string;
}

/**
* Model that represents a list of Capability Type resources and a link for pagination.
*/
model CapabilityTypeListResult is Azure.Core.Page<CapabilityType>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./capabilityType.models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Chaos;

@armResourceOperations
interface CapabilityTypes {
/**
* Get a Capability Type resource for given Target Type and location.
*/
get is ArmResourceRead<CapabilityType>;

/**
* Get a list of Capability Type resources for given Target Type and location.
*/
list is ArmResourceListByParent<
CapabilityType,
Parameters = {
/**
* String that sets the continuation token.
*/
@query("continuationToken")
continuationToken?: string;
},
Response = CapabilityTypeListResult
>;
}

@@doc(CapabilityType.name,
"String that represents a Capability Type resource name."
);
@@doc(CapabilityType.properties,
"The properties of the capability type resource."
);
Loading
Loading