# Bind Resources to Security Group - AssociateSecGroup

## Overview

Bind resources to security group

 > 💡 Multiple resources and security groups cannot be passed simultaneously. Repeated binding is supported, and this interface is also used to modify binding priorities. 

 > ℹ️ Only supports binding resources of the same resource type 


## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `AssociateSecGroup`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.ckcloudai.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. Please refer to [GetProjectList API](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. Leave blank for the default project, sub-accounts must fill in. Please refer to [GetProjectList API](/docs/api/summary/get_project_list) |No|
| **ResourceId.N** | string | Short ID for resources, the security group parameter and this field only support one batch. Supports string arrays. |**Yes**|
| **PrioritySecGroup.N.Priority** | int | Binding priority. This field and resource ID only support one batch. Supports JSON format arrays of PrioritySecGroup. |**Yes**|
| **PrioritySecGroup.N.SecGroupId** | string | Security Group ID. This field and Resource ID only support one batch. Supports JSON format array of PrioritySecGroup. |**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.ckcloudai.com/?Action=AssociateSecGroup
&Region=OUsdiWDK
&ProjectId=gWLANZey
&FWId=MwGpFQZd
&ResourceType=IJUSubKV
&ResourceId=fworMOuc
&PrioritySecGroup.N.SecGroupId=wSALafiE
```

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





