put_resource_policy
¶
put_resource_policy(
resource_arn: ComprehendModelArn,
resource_policy: Policy,
*,
config_overrides: Optional[ComprehendClientConfig] = None,
policy_revision_id: Optional[PolicyRevisionId] = None,
) -> PutResourcePolicyResponse
Attaches a resource-based policy to a custom model. You can use this policy to authorize an entity in another Amazon Web Services account to import the custom model, which replicates it in Amazon Comprehend in their account.
Parameters:
-
resource_arn(ComprehendModelArn) –The Amazon Resource Name (ARN) of the custom model to attach the policy to.
-
resource_policy(Policy) –The JSON resource-based policy to attach to your custom model. Provide your JSON as a UTF-8 encoded string without line breaks. To provide valid JSON for your policy, enclose the attribute names and values in double quotes. If the JSON body is also enclosed in double quotes, then you must escape the double quotes that are inside the policy:
"{\"attribute\": \"value\", \"attribute\": [\"value\"]}"To avoid escaping quotes, you can use single quotes to enclose the policy and double quotes to enclose the JSON names and values:
'{"attribute": "value", "attribute": ["value"]}' -
policy_revision_id(Optional[PolicyRevisionId], default:None) –The revision ID that Amazon Comprehend assigned to the policy that you are updating. If you are creating a new policy that has no prior version, don't use this parameter. Amazon Comprehend creates the revision ID for you.
Raises:
-
InternalServerException–An internal server error occurred. Retry your request.
-
InvalidRequestException–The request is invalid.
-
ResourceNotFoundException–The specified resource ARN was not found. Check the ARN and try your request again.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_comprehend/_services/comprehend.py
5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 | |