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

Showing Fleets in the Treeview #1237

Merged
merged 18 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 17 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
158 changes: 147 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@
"@azure/arm-features": "^3.1.0",
"@azure/arm-monitor": "^7.0.0",
"@azure/arm-msi": "^2.1.0",
"@azure/arm-resourcegraph": "^4.2.1",
"@azure/arm-resources": "^5.2.0",
"@azure/arm-resources-subscriptions": "^2.1.0",
"@azure/arm-storage": "^18.3.0",
Expand Down
Binary file added resources/fleet-tree-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 11 additions & 3 deletions src/azure-api-utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
export function parseResource(armId: string): { resourceGroupName: string | undefined; name: string | undefined } {
// /subscriptions/{subid}/resourcegroups/{group}/providers/.../{name}
export function parseResource(armId: string): {
parentResourceId: string | undefined;
subscriptionId: string | undefined;
resourceGroupName: string | undefined;
name: string | undefined;
} {
// General armId Format: /subscriptions/{subid}/resourcegroups/{group}/providers/.../{name}
// armId format of a member cluster, given parentResource is a Fleet {parentResourceId}/members/{name}
const bits = armId.split("/").filter((bit) => bit.length > 0);
const resourceGroupName = bits[3];
const subscriptionId = bits[1];
const name = bits[bits.length - 1];
return { resourceGroupName, name };
const parentResourceId = `/${bits.slice(0, bits.length - 2).join("/")}`; // take all except for the last two bits
return { parentResourceId, subscriptionId, resourceGroupName, name };
hsubramanianaks marked this conversation as resolved.
Show resolved Hide resolved
}

export function parseSubId(armId: string): { subId: string } {
Expand Down
5 changes: 5 additions & 0 deletions src/commands/utils/arm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ReadyAzureSessionProvider } from "../../auth/types";
import { Errorable, getErrorMessage } from "./errorable";
import { ComputeManagementClient } from "@azure/arm-compute";
import { ContainerServiceFleetClient } from "@azure/arm-containerservicefleet";
import { ResourceGraphClient } from "@azure/arm-resourcegraph";

export function getSubscriptionClient(sessionProvider: ReadyAzureSessionProvider): SubscriptionClient {
return new SubscriptionClient(getCredential(sessionProvider), { endpoint: getArmEndpoint() });
Expand All @@ -37,6 +38,10 @@ export function getAksClient(
return new ContainerServiceClient(getCredential(sessionProvider), subscriptionId, { endpoint: getArmEndpoint() });
}

export function getGraphResourceClient(sessionProvider: ReadyAzureSessionProvider): ResourceGraphClient {
return new ResourceGraphClient(getCredential(sessionProvider));
}

export function getAksFleetClient(
sessionProvider: ReadyAzureSessionProvider,
subscriptionId: string,
Expand Down
Loading
Loading