Hello,
I am facing the issue that the error occurred when I executed the python code below.
Please note that I granted the permission such as "Cloud Translation API admin" and "storage object viewer (or upper permission)" to my service account on the GCP, but it doesn't work.
I even granted project owner to the service account but the same error still persists.
Can somebody help me to resolve the issue because I have been stuck in this all day today?
This is executed code
----------------------------------
from google.cloud import translate_v3beta1 as translate
client = translate.TranslationServiceClient()
project_id = '*******'
glossary_id = '********'
location = 'us-central1' # The location of the glossary
name = client.glossary_path(
project_id,
location,
glossary_id)
language_codes_set = translate.types.Glossary.LanguageCodesSet(
language_codes=['ja', 'en'])
gcs_source = translate.types.GcsSource(
input_uri='gs://*********/Glossary-translate201909.csv')
input_config = translate.types.GlossaryInputConfig(
gcs_source=gcs_source)
glossary = translate.types.Glossary(
name=name,
language_codes_set=language_codes_set,
input_config=input_config)
parent = client.location_path(project_id, location)
operation = client.create_glossary(parent=parent, glossary=glossary)
result = operation.result(timeout=90)
print('Input Uri: {}'.format(result.input_config.gcs_source.input_uri))
----------------------------------
The error says below.
----------------------------------
Exception has occurred: PermissionDenied
403 Cloud IAM permission 'cloudtranslate.glossaries.create' denied.
File "C:\Users\h1015543\Documents\Python-study\v3beta1\Creating_a_glossary_resource.py", line 32, in <module>
operation = client.create_glossary(parent=parent, glossary=glossary)
----------------------------------
Thank you very much in advance.