Deletes a connection. While any agent context still uses the connection, the request fails with ConflictException. Remove the connection from each agent context with UpdateAgentContext, and wait until AWS Context has removed the connection's data from the agent context, before you retry. For a DATABRICKS or SNOWFLAKE connection, deletionMode specifies whether AWS Context also deletes the AWS Glue connection. If the connection stays DELETING, call DeleteConnection again to finish the cleanup. Deleting a connection that doesn't exist or is already being deleted succeeds, so you can safely retry.
Parameters:
-
connection_id
(ConnectionIdentifier)
–
The connection to delete, by its ID (which starts with conn-) or its ARN.
-
deletion_mode
(Optional[DeletionMode], default:
None
)
–
Specifies what happens to the connectivity resources behind the connection: the AWS Glue connection, whether AWS Context created it or you specified an existing one. AWS Context keeps the AWS Glue connections named in glueConnectionMappings. This member doesn't affect agent context content. To remove the connection's content from an agent context, remove the connection from the agent context with UpdateAgentContext. AWS Context never changes your source data. If you omit it, the default is RETAIN. It has no effect on GLUE_DATA_CATALOG and BEDROCK_KNOWLEDGE_BASE connections.
Raises:
-
AccessDeniedException
–
You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.
-
InternalServerException
–
The request failed because of an internal error. Retry the request.
-
ThrottlingException
–
The request was denied because it exceeded a request rate quota. Wait, then retry the request.
-
ValidationException
–
The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.
-
ConflictException
–
The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Delete a connection
The following example deletes the connection conn-e5f6a7b8c9d04e1f8a2b3c4d5e6f7a8b, which no agent context uses.
>>> client.delete_connection(connection_id='conn-e5f6a7b8c9d04e1f8a2b3c4d5e6f7a8b')
Source code in docs_src/capo_context/_services/context.py
| def delete_connection(
self,
connection_id: "capo_context.types.connection_identifier.ConnectionIdentifier",
*,
config_overrides: Optional[ContextClientConfig] = None,
deletion_mode: Optional["capo_context.types.deletion_mode.DeletionMode"] = None,
) -> "capo_context.types.delete_connection_response.DeleteConnectionResponse":
"""<p>Deletes a connection. While any agent context still uses the connection, the request fails with <code>ConflictException</code>. Remove the connection from each agent context with UpdateAgentContext, and wait until AWS Context has removed the connection's data from the agent context, before you retry. For a <code>DATABRICKS</code> or <code>SNOWFLAKE</code> connection, <code>deletionMode</code> specifies whether AWS Context also deletes the AWS Glue connection. If the connection stays <code>DELETING</code>, call DeleteConnection again to finish the cleanup. Deleting a connection that doesn't exist or is already being deleted succeeds, so you can safely retry.</p>
Args:
connection_id: <p>The connection to delete, by its ID (which starts with <code>conn-</code>) or its ARN.</p>
deletion_mode: <p>Specifies what happens to the connectivity resources behind the connection: the AWS Glue connection, whether AWS Context created it or you specified an existing one. AWS Context keeps the AWS Glue connections named in <code>glueConnectionMappings</code>. This member doesn't affect agent context content. To remove the connection's content from an agent context, remove the connection from the agent context with UpdateAgentContext. AWS Context never changes your source data. If you omit it, the default is <code>RETAIN</code>. It has no effect on <code>GLUE_DATA_CATALOG</code> and <code>BEDROCK_KNOWLEDGE_BASE</code> connections.</p>
Raises:
capo_context.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.</p>
capo_context.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Retry the request.</p>
capo_context.errors.throttling_exception.ThrottlingException: <p>The request was denied because it exceeded a request rate quota. Wait, then retry the request.</p>
capo_context.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.</p>
capo_context.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.</p>
capo_context.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Delete a connection
The following example deletes the connection conn-e5f6a7b8c9d04e1f8a2b3c4d5e6f7a8b, which no agent context uses.
>>> client.delete_connection(connection_id='conn-e5f6a7b8c9d04e1f8a2b3c4d5e6f7a8b')
"""
def _handler(
req: "OperationRequest[capo_context.types.delete_connection_request.DeleteConnectionRequest]",
) -> OperationResponse[
"capo_context.types.delete_connection_response.DeleteConnectionResponse"
]:
import capo_context._operations.context.delete_connection
output, http_response = (
capo_context._operations.context.delete_connection.delete_connection(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteConnection")
)
input_: capo_context.types.delete_connection_request.DeleteConnectionRequest = {
"connection_id": connection_id
}
if deletion_mode is not None:
input_["deletion_mode"] = deletion_mode
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|