Retrieves the contents of a managed permission in JSON format.
If the permission has template parameters, you can include the permissionTemplateParameters parameter in your request. The operation then renders the returned policy with the specified values in place of the template parameter placeholders. If you omit permissionTemplateParameters, the operation returns the raw policy template with @{parameterName} placeholders unchanged.
Parameters:
-
permission_arn
(String)
–
Specifies the Amazon Resource Name (ARN) of the permission whose contents you want to retrieve. To find the ARN for a permission, use either the ListPermissions operation or go to the Permissions library page in the RAM console and then choose the name of the permission. The ARN is displayed on the detail page.
-
permission_version
(Optional[Integer], default:
None
)
–
Specifies the version number of the RAM permission to retrieve. If you don't specify this parameter, the operation retrieves the default version.
To see the list of available versions, use ListPermissionVersions.
-
permission_template_parameters
(Optional[PermissionTemplateParameterInputList], default:
None
)
–
Specifies the template parameter values to use when rendering the permission's policy template. Each entry supplies a parameter name and its values. When you provide this parameter, the response contains the rendered policy with the specified values in place of the template parameter placeholders.
For STRING type parameters, provide a single value. For STRING_LIST type parameters, provide one or more values.
You can specify this parameter only for permissions that declare template parameters. You must provide values for all parameters declared in the permission template.
Raises:
Source code in docs_src/capo_ram/_services/ram.py
| def get_permission(
self,
permission_arn: "capo_ram.types.string.String",
*,
config_overrides: Optional[RAMClientConfig] = None,
permission_version: Optional["capo_ram.types.integer.Integer"] = None,
permission_template_parameters: Optional[
"capo_ram.types.permission_template_parameter_input_list.PermissionTemplateParameterInputList"
] = None,
) -> "capo_ram.types.get_permission_response.GetPermissionResponse":
"""<p>Retrieves the contents of a managed permission in JSON format.</p> <p>If the permission has template parameters, you can include the <code>permissionTemplateParameters</code> parameter in your request. The operation then renders the returned policy with the specified values in place of the template parameter placeholders. If you omit <code>permissionTemplateParameters</code>, the operation returns the raw policy template with <code>@{parameterName}</code> placeholders unchanged.</p>
Args:
permission_arn: <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the permission whose contents you want to retrieve. To find the ARN for a permission, use either the <a>ListPermissions</a> operation or go to the <a href="https://console.aws.amazon.com/ram/home#Permissions:">Permissions library</a> page in the RAM console and then choose the name of the permission. The ARN is displayed on the detail page.</p>
permission_version: <p>Specifies the version number of the RAM permission to retrieve. If you don't specify this parameter, the operation retrieves the default version.</p> <p>To see the list of available versions, use <a>ListPermissionVersions</a>.</p>
permission_template_parameters: <p>Specifies the template parameter values to use when rendering the permission's policy template. Each entry supplies a parameter name and its values. When you provide this parameter, the response contains the rendered policy with the specified values in place of the template parameter placeholders.</p> <p>For <code>STRING</code> type parameters, provide a single value. For <code>STRING_LIST</code> type parameters, provide one or more values.</p> <p>You can specify this parameter only for permissions that declare template parameters. You must provide values for all parameters declared in the permission template.</p>
Raises:
capo_ram.errors.invalid_parameter_exception.InvalidParameterException: <p>The operation failed because a parameter you specified isn't valid.</p>
capo_ram.errors.malformed_arn_exception.MalformedArnException: <p>The operation failed because the specified <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> has a format that isn't valid.</p>
capo_ram.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The operation failed because the requested operation isn't permitted.</p>
capo_ram.errors.server_internal_exception.ServerInternalException: <p>The operation failed because the service could not respond to the request due to an internal problem. Try again later.</p>
capo_ram.errors.service_unavailable_exception.ServiceUnavailableException: <p>The operation failed because the service isn't available. Try again later.</p>
capo_ram.errors.unknown_resource_exception.UnknownResourceException: <p>The operation failed because a specified resource couldn't be found.</p>
capo_ram.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ram.types.get_permission_request.GetPermissionRequest]",
) -> OperationResponse[
"capo_ram.types.get_permission_response.GetPermissionResponse"
]:
import capo_ram._operations.amazon_resource_sharing.get_permission
output, http_response = (
capo_ram._operations.amazon_resource_sharing.get_permission.get_permission(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetPermission")
)
input_: capo_ram.types.get_permission_request.GetPermissionRequest = {
"permission_arn": permission_arn
}
if permission_version is not None:
input_["permission_version"] = permission_version
if permission_template_parameters is not None:
input_["permission_template_parameters"] = permission_template_parameters
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|