Skip to content

[TSP Migration]--dashboard #34274

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
61 changes: 61 additions & 0 deletions specification/dashboard/Dashboard.Management/IntegrationFabric.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 "./models.tsp";
import "./ManagedGrafana.tsp";

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

namespace Microsoft.Dashboard;
/**
* The integration fabric resource type.
*/
@parentResource(ManagedGrafana)
model IntegrationFabric
is Azure.ResourceManager.TrackedResource<IntegrationFabricProperties> {
...ResourceNameParameter<
Resource = IntegrationFabric,
KeyName = "integrationFabricName",
SegmentName = "integrationFabrics",
NamePattern = "^[a-zA-Z][a-z0-9A-Z-]{0,18}[a-z0-9A-Z]$"
>;
}

@armResourceOperations
interface IntegrationFabrics {
get is ArmResourceRead<IntegrationFabric>;

create is ArmResourceCreateOrReplaceAsync<IntegrationFabric>;

#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" ""
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchAsync<
IntegrationFabric,
PatchModel = IntegrationFabricUpdateParameters,
LroHeaders = ArmAsyncOperationHeader<FinalResult = IntegrationFabric> &
Azure.Core.Foundations.RetryAfterHeader
>;

#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
delete is ArmResourceDeleteWithoutOkAsync<
IntegrationFabric,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
>;

list is ArmResourceListByParent<
IntegrationFabric,
Response = ArmResponse<IntegrationFabricListResponse>
>;
}

@@doc(IntegrationFabric.name,
"The integration fabric name of Azure Managed Grafana."
);
@@doc(IntegrationFabric.properties, "");
@@doc(IntegrationFabrics.create::parameters.resource, "");
@@doc(IntegrationFabrics.update::parameters.properties, "");
150 changes: 150 additions & 0 deletions specification/dashboard/Dashboard.Management/ManagedGrafana.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.Dashboard;
/**
* The grafana resource type.
*/
#suppress "@azure-tools/typespec-azure-core/no-private-usage" ""
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" ""
@Azure.ResourceManager.Private.armResourceInternal(ManagedGrafanaProperties)
@TypeSpec.Http.Private.includeInapplicableMetadataInPayload(false)
model ManagedGrafana extends Azure.ResourceManager.Foundations.TrackedResource {
...ResourceNameParameter<
Resource = ManagedGrafana,
KeyName = "workspaceName",
SegmentName = "grafana",
NamePattern = "^[a-zA-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]$"
>;

/**
* The Sku of the grafana resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "For backward compatibility"
sku?: ResourceSku;

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" ""
#suppress "@azure-tools/typespec-azure-core/no-private-usage" ""
@doc("The resource-specific properties for this resource.")
@Azure.ResourceManager.Private.conditionalClientFlatten
@Azure.ResourceManager.Private.armResourcePropertiesOptionality(true)
properties?: ManagedGrafanaProperties;

...Azure.ResourceManager.ManagedServiceIdentityProperty;
}

@armResourceOperations
interface ManagedGrafanas {
/**
* Get the properties of a specific workspace for Grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_Get")
get is ArmResourceRead<ManagedGrafana>;

/**
* Create or update a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_Create")
create is ArmResourceCreateOrReplaceAsync<ManagedGrafana>;

/**
* Update a workspace for Grafana resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" ""
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@patch(#{ implicitOptionality: false })
@operationId("Grafana_Update")
update is ArmCustomPatchSync<
ManagedGrafana,
PatchModel = ManagedGrafanaUpdateParameters,
Response = ArmResponse<ManagedGrafana> | (AcceptedResponse & {
@bodyRoot
_: ManagedGrafana;
})
>;

/**
* Delete a workspace for Grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
@operationId("Grafana_Delete")
delete is ArmResourceDeleteWithoutOkAsync<
ManagedGrafana,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse<ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader> | ArmDeletedNoContentResponse
>;

/**
* List all resources of workspaces for Grafana under the specified resource group.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_ListByResourceGroup")
listByResourceGroup is ArmResourceListByParent<
ManagedGrafana,
Response = ArmResponse<ManagedGrafanaListResponse>
>;

/**
* List all resources of workspaces for Grafana under the specified subscription.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_List")
list is ArmListBySubscription<
ManagedGrafana,
Response = ArmResponse<ManagedGrafanaListResponse>
>;

/**
* Retrieve enterprise add-on details information
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_CheckEnterpriseDetails")
checkEnterpriseDetails is ArmResourceActionSync<
ManagedGrafana,
void,
ArmResponse<EnterpriseDetails>
>;

#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Grafana_FetchAvailablePlugins")
fetchAvailablePlugins is ArmResourceActionSync<
ManagedGrafana,
void,
ArmResponse<GrafanaAvailablePluginListResponse>
>;

/**
* Refresh and sync managed private endpoints of a grafana resource to latest state.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" ""
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@action("refreshManagedPrivateEndpoints")
@operationId("ManagedPrivateEndpoints_Refresh")
refresh is ArmResourceActionAsync<
ManagedGrafana,
void,
OkResponse,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
>;
}

@@doc(ManagedGrafana.name, "The workspace name of Azure Managed Grafana.");
@@doc(ManagedGrafana.properties,
"Properties specific to the grafana resource."
);
@@doc(ManagedGrafanas.create::parameters.resource, "");
@@doc(ManagedGrafanas.update::parameters.properties, "");
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./ManagedGrafana.tsp";

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

namespace Microsoft.Dashboard;
/**
* The managed private endpoint resource type.
*/
@parentResource(ManagedGrafana)
model ManagedPrivateEndpointModel
is Azure.ResourceManager.TrackedResource<ManagedPrivateEndpointModelProperties> {
...ResourceNameParameter<
Resource = ManagedPrivateEndpointModel,
KeyName = "managedPrivateEndpointName",
SegmentName = "managedPrivateEndpoints",
NamePattern = ""
>;
}

@armResourceOperations
interface ManagedPrivateEndpointModels {
/**
* Get a specific managed private endpoint of a grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("ManagedPrivateEndpoints_Get")
get is ArmResourceRead<ManagedPrivateEndpointModel>;

/**
* Create or update a managed private endpoint for a grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@Azure.Core.useFinalStateVia("original-uri")
@operationId("ManagedPrivateEndpoints_Create")
create is ArmResourceCreateOrReplaceAsync<
ManagedPrivateEndpointModel,
Response = ArmResourceUpdatedResponse<ManagedPrivateEndpointModel> | ArmResourceCreatedResponse<
Resource = ManagedPrivateEndpointModel,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
>
>;

/**
* Update a managed private endpoint for an existing grafana resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" ""
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@patch(#{ implicitOptionality: false })
@operationId("ManagedPrivateEndpoints_Update")
update is ArmCustomPatchAsync<
ManagedPrivateEndpointModel,
PatchModel = ManagedPrivateEndpointUpdateParameters,
Response = ArmResponse<ManagedPrivateEndpointModel> | (ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = ManagedPrivateEndpointModel> &
Azure.Core.Foundations.RetryAfterHeader> & {
@bodyRoot
_: ManagedPrivateEndpointModel;
})
>;

/**
* Delete a managed private endpoint for a grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
@operationId("ManagedPrivateEndpoints_Delete")
delete is ArmResourceDeleteWithoutOkAsync<
ManagedPrivateEndpointModel,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse<ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader> | ArmDeletedNoContentResponse
>;

/**
* List all managed private endpoints of a grafana resource.
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("ManagedPrivateEndpoints_List")
list is ArmResourceListByParent<
ManagedPrivateEndpointModel,
Response = ArmResponse<ManagedPrivateEndpointModelListResponse>
>;
}

@@doc(ManagedPrivateEndpointModel.name,
"The managed private endpoint name of Azure Managed Grafana."
);
@@doc(ManagedPrivateEndpointModel.properties, "Resource properties.");
@@doc(ManagedPrivateEndpointModels.create::parameters.resource,
"The managed private endpoint to be created or updated."
);
@@doc(ManagedPrivateEndpointModels.update::parameters.properties,
"Properties that can be updated to an existing managed private endpoint."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./ManagedGrafana.tsp";

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

namespace Microsoft.Dashboard;
/**
* The Private Endpoint Connection resource.
*/
@parentResource(ManagedGrafana)
model PrivateEndpointConnection
is Azure.ResourceManager.ProxyResource<PrivateEndpointConnectionProperties> {
...ResourceNameParameter<
Resource = PrivateEndpointConnection,
KeyName = "privateEndpointConnectionName",
SegmentName = "privateEndpointConnections",
NamePattern = ""
>;
}

@armResourceOperations
interface PrivateEndpointConnections {
/**
* Get private endpoint connections.
*/
get is ArmResourceRead<PrivateEndpointConnection>;

/**
* Manual approve private endpoint connection
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
approve is ArmResourceCreateOrReplaceAsync<
PrivateEndpointConnection,
Response = ArmResourceCreatedResponse<PrivateEndpointConnection> | ArmResourceCreatedResponse<
Resource = PrivateEndpointConnection,
LroHeaders = ArmAsyncOperationHeader<FinalResult = PrivateEndpointConnection> &
Azure.Core.Foundations.RetryAfterHeader
>
>;

/**
* Delete private endpoint connection
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
delete is ArmResourceDeleteWithoutOkAsync<
PrivateEndpointConnection,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Get private endpoint connection
*/
list is ArmResourceListByParent<PrivateEndpointConnection>;
}

@@doc(PrivateEndpointConnection.name,
"The private endpoint connection name of Azure Managed Grafana."
);
@@doc(PrivateEndpointConnection.properties, "Resource properties.");
@@doc(PrivateEndpointConnections.approve::parameters.resource, "");
Loading
Loading