Skip to content

Commit 2f8c931

Browse files
[translation] update target container permissions (Azure#19992)
* Update testcase.py * update to aka links for sas permissions
1 parent f64daef commit 2f8c931

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

sdk/translation/azure-ai-translation-document/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
406406
[custom_model]: https://docs.microsoft.com/azure/cognitive-services/translator/custom-translator/quickstart-build-deploy-custom-model
407407
[glossary]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview#supported-glossary-formats
408408
[sas_token]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/create-sas-tokens?tabs=Containers#create-your-sas-tokens-with-azure-storage-explorer
409-
[sas_token_permissions]: https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/get-started-with-document-translation?tabs=csharp#create-sas-access-tokens-for-document-translation
409+
[sas_token_permissions]: https://aka.ms/azsdk/documenttranslation/sas-permissions
410410
[azure_storage_blob]: https://pypi.org/project/azure-storage-blob/
411411

412412
[azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ def begin_translation(
122122
https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview
123123
124124
:param str source_url: The source SAS URL to the Azure Blob container containing the documents
125-
to be translated. Requires read and list permissions at the minimum.
125+
to be translated. See the service documentation for the supported SAS permissions for accessing
126+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
126127
:param str target_url: The target SAS URL to the Azure Blob container where the translated documents
127-
should be written. Requires write and list permissions at the minimum.
128+
should be written. See the service documentation for the supported SAS permissions for accessing
129+
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
128130
:param str target_language_code: This is the language you want your documents to be translated to.
129131
See supported language codes here:
130132
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class TranslationGlossary(object): # pylint: disable=useless-object-inheritance
2020
2121
:param str glossary_url: Required. Location of the glossary file. This should be a SAS URL to
2222
the glossary file in the storage blob container. If the translation language pair is
23-
not present in the glossary, it will not be applied.
23+
not present in the glossary, it will not be applied. See the service documentation for the
24+
supported SAS permissions: https://aka.ms/azsdk/documenttranslation/sas-permissions
2425
:param str file_format: Required. Format of the glossary file. To see supported formats,
2526
call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method.
2627
:keyword str format_version: File format version. If not specified, the service will
@@ -31,7 +32,8 @@ class TranslationGlossary(object): # pylint: disable=useless-object-inheritance
3132
3233
:ivar str glossary_url: Required. Location of the glossary file. This should be a SAS URL to
3334
the glossary file in the storage blob container. If the translation language pair is
34-
not present in the glossary, it will not be applied.
35+
not present in the glossary, it will not be applied. See the service documentation for the
36+
supported SAS permissions: https://aka.ms/azsdk/documenttranslation/sas-permissions
3537
:ivar str file_format: Required. Format of the glossary file. To see supported formats,
3638
call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method.
3739
:ivar str format_version: File format version. If not specified, the service will
@@ -79,7 +81,9 @@ class TranslationTarget(object): # pylint: disable=useless-object-inheritance
7981
"""Destination for the finished translated documents.
8082
8183
:param str target_url: Required. The target location for your translated documents.
82-
This should be a container SAS URL to your target container.
84+
This should be a container SAS URL to your target container/blob. See the service
85+
documentation for the supported SAS permissions for accessing
86+
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
8387
:param str language_code: Required. Target Language Code. This is the language
8488
you want your documents to be translated to. See supported languages here:
8589
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate
@@ -90,7 +94,9 @@ class TranslationTarget(object): # pylint: disable=useless-object-inheritance
9094
Currently only "AzureBlob" is supported.
9195
9296
:ivar str target_url: Required. The target location for your translated documents.
93-
This should be a container SAS URL to your target container.
97+
This should be a container SAS URL to your target container/blob. See the service
98+
documentation for the supported SAS permissions for accessing
99+
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
94100
:ivar str language_code: Required. Target Language Code. This is the language
95101
you want your documents to be translated to. See supported languages here:
96102
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate
@@ -150,7 +156,8 @@ class DocumentTranslationInput(object): # pylint: disable=useless-object-inheri
150156
translated and written to the location provided by the TranslationTargets.
151157
152158
:param str source_url: Required. Location of the folder / container or single file with your
153-
documents.
159+
documents. See the service documentation for the supported SAS permissions for accessing
160+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
154161
:param targets: Required. Location of the destination for the output. This is a list of
155162
TranslationTargets. Note that a TranslationTarget is required for each language code specified.
156163
:type targets: list[~azure.ai.translation.document.TranslationTarget]
@@ -168,7 +175,8 @@ class DocumentTranslationInput(object): # pylint: disable=useless-object-inheri
168175
Currently only "AzureBlob" is supported.
169176
170177
:ivar str source_url: Required. Location of the folder / container or single file with your
171-
documents.
178+
documents. See the service documentation for the supported SAS permissions for accessing
179+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
172180
:ivar targets: Required. Location of the destination for the output. This is a list of
173181
TranslationTargets. Note that a TranslationTarget is required for each language code specified.
174182
:vartype targets: list[~azure.ai.translation.document.TranslationTarget]

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ async def begin_translation(
131131
https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview
132132
133133
:param str source_url: The source SAS URL to the Azure Blob container containing the documents
134-
to be translated. Requires read and list permissions at the minimum.
134+
to be translated. See the service documentation for the supported SAS permissions for accessing
135+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
135136
:param str target_url: The target SAS URL to the Azure Blob container where the translated documents
136-
should be written. Requires write and list permissions at the minimum.
137+
should be written. See the service documentation for the supported SAS permissions for accessing
138+
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
137139
:param str target_language_code: This is the language you want your documents to be translated to.
138140
See supported language codes here:
139141
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate

sdk/translation/azure-ai-translation-document/tests/testcase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def create_target_container(self, data=None):
127127
if data:
128128
self.upload_documents(data, container_client)
129129

130-
return self.generate_sas_url(self.target_container_name, "rw")
130+
return self.generate_sas_url(self.target_container_name, "wl")
131131

132132
def generate_sas_url(self, container_name, permission):
133133

0 commit comments

Comments
 (0)