gbvikas
gbvikas

Reputation: 49

How to list GCP project labels in Cloud function?

Below documentation has details for accessing various GCP resources but not GCP project. I am interested in listing all the labels of a GCP project using .net API.

https://cloud.google.com/dotnet/docs/reference

Any references/links will be helpful

Upvotes: 0

Views: 618

Answers (2)

gbvikas
gbvikas

Reputation: 49

Found the solution.

        Google.Cloud.ResourceManager.V3.ProjectsClient projectsClient = await Google.Cloud.ResourceManager.V3.ProjectsClient.CreateAsync();
        Google.Cloud.ResourceManager.V3.Project response = await projectsClient.GetProjectAsync("projects/83446985491");
        //response.Labels;

Source: https://cloud.google.com/dotnet/docs/reference/Google.Cloud.ResourceManager.V3/latest/Google.Cloud.ResourceManager.V3.Projects.ProjectsClient

Upvotes: 1

Darwin
Darwin

Reputation: 490

As mentioned in this SO thread, Currently, it's not possible to list all labels within a GCP project.

In Addition, There is an existing feature request, you can star this feature request and add Me too in the thread. This will bring more attention to the request as more users request support for it but there's no guarantee when it will be implemented.

Upvotes: 0

Related Questions