I am trying to list out projects using resourcemanager api. I am using the below code.
from google.cloud import resourcemanager
from google.cloud.resourcemanager import ProjectsClient
from google.oauth2 import service_account
path_json_file = "C:\\Users\\######\\Downloads\\dev-####-analyt-datal-svc- db.json"
credentials = service_account.Credentials.from_service_account_file(path_json_file)
client =resourcemanager.ProjectsClient(credentials=credentials)
print(client)
request = resourcemanager.ListProjectsRequest(
parent="###-amea-fldr/###-amea-analytics-fldr/##-amea-analytics-dev-fldr",
)
page_result = client.list_projects(request=request)
print(page_result)
I am using service account authentication. It has resourcemanager.projects.list permission also.
But I am getting the below error.
raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "Request contains an invalid argument."
debug_error_string = "{"created":"@1658894641.118000000","description":"Error received
from peer ipv6:[2404:6800:4007:809::200a]:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Request contains an invalid argument.","grpc_status":3}"
Is this due to any error in the value passed to the argument "parent"?
Whether the way I have called the list_projects method is correct?