

# DeleteConnection

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.

## Request Parameters
<a name="API_DeleteConnection_RequestParameters"></a>

 ** connectionId **   
The connection to delete, by its ID (which starts with `conn-`) or its ARN.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:connection/)?[a-z0-9]+(-[a-z0-9]+)*`   
Required: Yes

 ** deletionMode **   
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.  
Type: String  
Valid Values: `RETAIN | DELETE`   
Required: No

## Errors
<a name="API_DeleteConnection_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.    
 ** message **   
A message that describes the error.
HTTP Status Code: 403

 ** ConflictException **   
The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that caused the conflict. When several resources caused it, a comma-separated list of their IDs.  
 ** resourceType **   
The type of the resource that caused the conflict.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 409

 ** InternalServerException **   
The request failed because of an internal error. Retry the request.    
 ** message **   
A message that describes the error.
HTTP Status Code: 500

 ** ThrottlingException **   
The request was denied because it exceeded a request rate quota. Wait, then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that throttled the request.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request, if AWS Context provides one.  
 ** serviceCode **   
The code of the service whose quota throttled the request.
HTTP Status Code: 429

 ** ValidationException **   
The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.    
 ** fieldList **   
The fields that failed validation, each with a message that describes why.  
 ** message **   
A message that describes the error.  
 ** reason **   
The reason that the input failed validation. Valid values:  
+  `unknownOperation` - The operation isn't recognized.
+  `cannotParse` - The request couldn't be parsed.
+  `fieldValidationFailed` - One or more fields failed validation. `fieldList` describes them.
+  `other` - Another reason. `message` describes it.
HTTP Status Code: 400

## See Also
<a name="API_DeleteConnection_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/context-2022-07-26/DeleteConnection) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/context-2022-07-26/DeleteConnection) 