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
40 changes: 40 additions & 0 deletions specification/impact/Impact.Management/client.tsp
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";
import "@typespec/versioning";

using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using Microsoft.Impact;

@@clientName(Microsoft.Impact, "ImpactReportingMgmtClient", "java");
Expand Down Expand Up @@ -74,3 +79,38 @@ using Microsoft.Impact;
Azure.Core.armResourceIdentifier,
"csharp"
);

// JavaScript SDK visibility workaround:
// For write operations whose body models contain server-side read-only properties
// that are also required, provide write-specific models that omit those fields so
// JS SDK users are not forced to supply server-computed values.
// Pattern: https://github.com/Azure/azure-rest-api-specs/pull/42784
#suppress "@azure-tools/typespec-azure-resource-manager/missing-operations-endpoint" "Write-only helper models for JS SDK alternate types; operations are defined on the original resources in connectors.tsp"
namespace Microsoft.Impact {
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" ""
@doc("Connector properties for create/update operations, omitting server-side read-only fields (connectorId, tenantId, lastRunTimeStamp, processingState, processingStateMessage are required+read-only in the canonical model).")
model ConnectorPropertiesCreate {
@doc("connector type")
connectorType: Platform;
}

@subscriptionResource
@doc("Connector resource for create/update operations.")
model ConnectorResourceCreate
is Azure.ResourceManager.ProxyResource<ConnectorPropertiesCreate> {
@doc("The name of the connector")
@pattern("^[a-zA-Z0-9-]{3,24}$")
@key("connectorName")
@segment("connectors")
@path
name: string;

...ConnectorManagedUserAssignedIdentityProperty;
}
}

@@alternateType(
Connectors.createOrUpdate::parameters.resource,
ConnectorResourceCreate,
"javascript"
);
15 changes: 14 additions & 1 deletion specification/impact/Impact.Management/connectors.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,25 @@ union Platform {
@doc("Type of Azure Monitor")
AzureMonitor: "AzureMonitor",
}
@doc("The type used for update operations of the Connector.")
model ConnectorUpdate
is OptionalProperties<UpdateableProperties<OmitProperties<
Connector,
"Name" | "name" | "properties"
>>> {
/** The resource-specific properties for this resource. */
properties?: ConnectorUpdateProperties;
}

model ConnectorUpdateProperties is Azure.ResourceManager.Foundations.ResourceUpdateModelProperties<
Connector,
ConnectorProperties
>;
@armResourceOperations(Connector)
interface Connectors {
get is ArmResourceRead<Connector>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<Connector>;
update is ArmResourcePatchSync<Connector, ConnectorProperties>;
update is ArmCustomPatchSync<Connector, ConnectorUpdate>;
delete is ArmResourceDeleteSync<Connector>;
listBySubscription is ArmListBySubscription<Connector>;
}
1 change: 1 addition & 0 deletions specification/impact/Impact.Management/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ linter:
options:
"@azure-tools/typespec-autorest":
use-read-only-status-schema: true
omit-unreachable-types: true
emitter-output-dir: "{project-root}/.."
azure-resource-provider-folder: "resource-manager"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/impact.json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,29 +898,6 @@
}
},
"definitions": {
"AdditionalField": {
"type": "object",
"description": "additional user defined field.",
"properties": {
"name": {
"type": "string",
"description": "name of the field."
},
"value": {
"type": "string",
"description": "value of the field."
}
},
"required": [
"name",
"value"
]
},
"Azure.Core.uuid": {
"type": "string",
"format": "uuid",
"description": "Universally Unique Identifier"
},
"ClientIncidentDetails": {
"type": "object",
"description": "Client incident details ex: incidentId , incident source",
Expand Down Expand Up @@ -1028,16 +1005,6 @@
"value"
]
},
"ConnectorManagedUserAssignedIdentityProperty": {
"type": "object",
"description": "The managed service identities envelope.",
"properties": {
"identity": {
"$ref": "#/definitions/ManagedServiceIdentityOnlyUserAssigned",
"description": "The managed service identities assigned to this resource."
}
}
},
"ConnectorProperties": {
"type": "object",
"description": "Details of the Connector.",
Expand Down Expand Up @@ -1087,34 +1054,29 @@
"processingStateMessage"
]
},
"ConnectorPropertiesUpdate": {
"ConnectorUpdate": {
"type": "object",
"description": "Details of the Connector.",
"description": "The type used for update operations of the Connector.",
"properties": {
"connectorType": {
"$ref": "#/definitions/Platform",
"description": "connector type"
"identity": {
"$ref": "#/definitions/ManagedServiceIdentityOnlyUserAssigned",
"description": "The managed service identities assigned to this resource."
},
"properties": {
"$ref": "#/definitions/ConnectorUpdateProperties",
"description": "The resource-specific properties for this resource."
}
}
},
"ConnectorUpdate": {
"ConnectorUpdateProperties": {
"type": "object",
"description": "A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft.",
"description": "The updatable properties of the Connector.",
"properties": {
"properties": {
"$ref": "#/definitions/ConnectorPropertiesUpdate",
"description": "The resource-specific properties for this resource."
},
"identity": {
"$ref": "#/definitions/ManagedServiceIdentityOnlyUserAssignedUpdate",
"description": "The managed service identities assigned to this resource."
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ProxyResource"
"connectorType": {
"$ref": "#/definitions/Platform",
"description": "connector type"
}
]
}
},
"Content": {
"type": "object",
Expand Down Expand Up @@ -1213,36 +1175,6 @@
}
]
},
"ImpactCategoryEnum": {
"type": "string",
"description": "List of impact categories.",
"enum": [
"Availability",
"Performance",
"Other"
],
"x-ms-enum": {
"name": "ImpactCategoryEnum",
"modelAsString": true,
"values": [
{
"name": "Availability",
"value": "Availability",
"description": "Availability category"
},
{
"name": "Performance",
"value": "Performance",
"description": "Performance category"
},
{
"name": "Other",
"value": "Other",
"description": "Other category"
}
]
}
},
"ImpactCategoryListResult": {
"type": "object",
"description": "The response of a ImpactCategory list operation.",
Expand Down Expand Up @@ -1329,19 +1261,6 @@
"impactId"
]
},
"ImpactedResource": {
"type": "object",
"description": "impacted azure resource id.",
"properties": {
"impactedResourceId": {
"type": "string",
"description": "impacted azure resource id"
}
},
"required": [
"impactedResourceId"
]
},
"IncidentSource": {
"type": "string",
"description": "List of incident interfaces.",
Expand Down Expand Up @@ -1399,79 +1318,6 @@
}
]
},
"InsightCategoryGroup": {
"type": "object",
"description": "Group of insights for a category",
"properties": {
"category": {
"type": "string",
"description": "Category name"
},
"status": {
"type": "string",
"description": "Status of the insights in this category"
},
"insights": {
"type": "array",
"description": "List of insight references in this category",
"items": {
"$ref": "#/definitions/InsightReference"
},
"x-ms-identifiers": [
"id"
]
}
},
"required": [
"category"
]
},
"InsightCustomResourceCommonParameters": {
"type": "object",
"description": "context of post call for insight",
"properties": {
"apiVersion": {
"type": "string",
"description": "The API version to use for this operation.",
"minLength": 1
},
"subscriptionId": {
"$ref": "#/definitions/Azure.Core.uuid",
"description": "The ID of the target subscription. The value must be an UUID.",
"minLength": 1
},
"provider": {
"type": "string",
"description": "The provider namespace for the resource.",
"enum": [
"Microsoft.Impact"
],
"x-ms-enum": {
"modelAsString": false
}
},
"azureResourceId": {
"type": "string",
"description": "Filter by resource type",
"minLength": 1
}
},
"required": [
"apiVersion",
"subscriptionId",
"provider"
]
},
"InsightDetails": {
"type": "object",
"description": "Body of the get all insights",
"properties": {
"azureResourceId": {
"type": "string",
"description": "The ID of the azure resource."
}
}
},
"InsightListResult": {
"type": "object",
"description": "The response of a Insight list operation.",
Expand Down Expand Up @@ -1547,34 +1393,6 @@
"impact"
]
},
"InsightReference": {
"type": "object",
"description": "Reference to an Insight resource",
"properties": {
"id": {
"type": "string",
"description": "Azure resource ID of the insight"
}
},
"required": [
"id"
]
},
"InsightUnderSubscription": {
"type": "object",
"description": "Insight resource",
"properties": {
"properties": {
"$ref": "#/definitions/InsightProperties",
"description": "The resource-specific properties for this resource."
}
},
"allOf": [
{
"$ref": "../../../../../common-types/resource-management/v5/types.json#/definitions/ProxyResource"
}
]
},
"ManagedServiceIdentityOnlyUserAssigned": {
"type": "object",
"description": "Managed service identity (system assigned and/or user assigned identities)",
Expand All @@ -1596,24 +1414,6 @@
"type"
]
},
"ManagedServiceIdentityOnlyUserAssignedUpdate": {
"type": "object",
"description": "Managed service identity (system assigned and/or user assigned identities)",
"properties": {
"type": {
"$ref": "#/definitions/ManagedServiceIdentityTypeOnlyUserAssigned",
"description": "The type of managed identity assigned to this resource."
},
"userAssignedIdentities": {
"type": "object",
"description": "The identities assigned to this resource by the user.",
"additionalProperties": {
"$ref": "../../../../../common-types/resource-management/v5/managedidentity.json#/definitions/UserAssignedIdentity",
"x-nullable": true
}
}
}
},
"ManagedServiceIdentityTypeOnlyUserAssigned": {
"type": "string",
"description": "Type of managed service identity, where only UserAssigned type is allowed.",
Expand Down
Loading
Loading