Returns a database user name and temporary password with temporary authorization to log in to an Amazon Redshift database. The database user is mapped 1:1 to the source Identity and Access Management (IAM) identity. For more information about IAM identities, see IAM Identities (users, user groups, and roles) in the Amazon Web Services Identity and Access Management User Guide.
The Identity and Access Management (IAM) identity that runs this operation must have an IAM policy attached that allows access to all necessary actions and resources. For more information about permissions, see Using identity-based policies (IAM policies) in the Amazon Redshift Cluster Management Guide.
Parameters:
-
db_name
(Optional[String], default:
None
)
–
The name of the database for which you are requesting credentials. If the database name is specified, the IAM policy must allow access to the resource dbname for the specified database name. If the database name is not specified, access to all databases is allowed.
-
cluster_identifier
(Optional[String], default:
None
)
–
The unique identifier of the cluster that contains the database for which you are requesting credentials.
-
duration_seconds
(Optional[IntegerOptional], default:
None
)
–
The number of seconds until the returned temporary password expires.
Range: 900-3600. Default: 900.
-
custom_domain_name
(Optional[String], default:
None
)
–
The custom domain name for the IAM message cluster credentials.
Raises:
Source code in docs_src/capo_redshift/_services/redshift.py
| def get_cluster_credentials_with_iam(
self,
*,
config_overrides: Optional[RedshiftClientConfig] = None,
db_name: Optional["capo_redshift.types.string.String"] = None,
cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
duration_seconds: Optional[
"capo_redshift.types.integer_optional.IntegerOptional"
] = None,
custom_domain_name: Optional["capo_redshift.types.string.String"] = None,
) -> "capo_redshift.types.cluster_extended_credentials.ClusterExtendedCredentials":
"""<p>Returns a database user name and temporary password with temporary authorization to log in to an Amazon Redshift database. The database user is mapped 1:1 to the source Identity and Access Management (IAM) identity. For more information about IAM identities, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html">IAM Identities (users, user groups, and roles)</a> in the Amazon Web Services Identity and Access Management User Guide.</p> <p>The Identity and Access Management (IAM) identity that runs this operation must have an IAM policy attached that allows access to all necessary actions and resources. For more information about permissions, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html">Using identity-based policies (IAM policies)</a> in the Amazon Redshift Cluster Management Guide. </p>
Args:
db_name: <p>The name of the database for which you are requesting credentials. If the database name is specified, the IAM policy must allow access to the resource <code>dbname</code> for the specified database name. If the database name is not specified, access to all databases is allowed.</p>
cluster_identifier: <p>The unique identifier of the cluster that contains the database for which you are requesting credentials. </p>
duration_seconds: <p>The number of seconds until the returned temporary password expires.</p> <p>Range: 900-3600. Default: 900.</p>
custom_domain_name: <p>The custom domain name for the IAM message cluster credentials.</p>
Raises:
capo_redshift.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster. </p>
capo_redshift.errors.unsupported_operation_fault.UnsupportedOperationFault: <p>The requested operation isn't supported.</p>
capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_redshift.types.get_cluster_credentials_with_iam_message.GetClusterCredentialsWithIAMMessage]",
) -> OperationResponse[
"capo_redshift.types.cluster_extended_credentials.ClusterExtendedCredentials"
]:
import capo_redshift._operations.redshift_service_version20121201.get_cluster_credentials_with_iam
output, http_response = (
capo_redshift._operations.redshift_service_version20121201.get_cluster_credentials_with_iam.get_cluster_credentials_with_iam(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_redshift.types.cluster_extended_credentials.ClusterExtendedCredentials",
) -> dict[str, Any]:
import capo_redshift.types.cluster_extended_credentials
return capo_redshift.types.cluster_extended_credentials.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"GetClusterCredentialsWithIAM", redact_output=_redact_output
),
)
input_: capo_redshift.types.get_cluster_credentials_with_iam_message.GetClusterCredentialsWithIAMMessage = {}
if db_name is not None:
input_["db_name"] = db_name
if cluster_identifier is not None:
input_["cluster_identifier"] = cluster_identifier
if duration_seconds is not None:
input_["duration_seconds"] = duration_seconds
if custom_domain_name is not None:
input_["custom_domain_name"] = custom_domain_name
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|