# Change Security Group Binding Relationship - UpdateSecGroupAssociation

## Overview

Only affects the security group ID being operated on, other existing bindings remain unaffected.



 > ℹ️ This interface is used to first unbind some security groups (parameter OldSecGroupId) from a single resource, and then bind some security groups (NewPrioritySecGroup).


## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `UpdateSecGroupAssociation`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.nubexcloud.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [Region and Availability Zone List](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. Leave blank for the default project, sub-account must fill in. Please refer to [GetProjectList API](/docs/api/summary/get_project_list) |No|
| **ResourceId** | string | Resource ID |**Yes**|
| **OldSecGroupId.N** | string | The security group ID to be replaced. Supports array format, i.e., a string array. |**Yes**|
| **NewPrioritySecGroup.N.Priority** | int | Need to bind the priority of the new security group. Support NewPrioritySecGroup in array format, i.e., pass the corresponding data in JSON format array. |**Yes**|
| **NewPrioritySecGroup.N.SecGroupId** | string | Security Group ID to be newly bound |**Yes**|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|




## Example

### Request Example
    
```
https://api.nubexcloud.com/?Action=UpdateSecGroupAssociation
&Region=AARqFomP
&ProjectId=NLyPDsnf
&SecGroupId.n=fqWNNxvJ
&ResourceId.n=ercRryXn
&NewSecGroupId.n=RQrYZhoX
&NewPrioritySecGroup.N.SecGroupId=sMwScEex
```

### Response Example
    
```json
{
  "Action": "UpdateSecGroupAssociationResponse",
  "RetCode": 0
}
```





