You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/react/azure/queries/utils.ts

52 lines
1.0 KiB

import { EnvironmentId } from '@/react/portainer/environments/types';
export function buildSubscriptionsUrl(
environmentId: EnvironmentId,
id?: string
) {
let url = `/endpoints/${environmentId}/azure/subscriptions`;
if (id) {
url += `/${id}`;
}
return url;
}
export function buildResourceGroupUrl(
environmentId: EnvironmentId,
subscriptionId: string,
resourceGroupName?: string
) {
let url = `${buildSubscriptionsUrl(
environmentId,
subscriptionId
)}/resourcegroups`;
if (resourceGroupName) {
url += `/${resourceGroupName}`;
}
return url;
}
export function buildContainerGroupUrl(
environmentId: EnvironmentId,
subscriptionId: string,
resourceGroupName?: string,
containerGroupName?: string
) {
let url = buildSubscriptionsUrl(environmentId, subscriptionId);
if (resourceGroupName) {
url += `/resourceGroups/${resourceGroupName}`;
}
url += `/providers/Microsoft.ContainerInstance/containerGroups`;
if (containerGroupName) {
url += `/${containerGroupName}`;
}
return url;
}