Skip to content

Commit

Permalink
feat/waf
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenEarth committed Sep 19, 2023
1 parent 72a3c0e commit 64d8b91
Show file tree
Hide file tree
Showing 17 changed files with 2,920 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .changelog/2111.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ tencentcloud_waf_clb_domain
tencentcloud_waf_saas_domain
```

```release-note:new-resource
tencentcloud_waf_clb_instance
```

```release-note:new-resource
tencentcloud_waf_saas_instance
```

```release-note:new-data-source
tencentcloud_waf_ciphers
```
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.693
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.544
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.711
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.748
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.751
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.624
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.589
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.692
Expand Down Expand Up @@ -100,7 +100,7 @@ require (
gopkg.in/yaml.v2 v2.4.0
)

require github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.748
require github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.751

require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
Expand Down
460 changes: 460 additions & 0 deletions go.sum

Large diffs are not rendered by default.

217 changes: 217 additions & 0 deletions tencentcloud/extension_waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,220 @@ const (
ORDER_ASC = "asc"
ORDER_DESC = "desc"
)

const (
WAF_PREMIUM_SAAS = "premium_saas"
WAF_ENTERPRISE_SAAS = "enterprise_saas"
WAF_ULTIMATE_SAAS = "ultimate_saas"
)

var WAF_CATEGORY_SAAS = []string{
WAF_PREMIUM_SAAS,
WAF_ENTERPRISE_SAAS,
WAF_ULTIMATE_SAAS,
}

const (
WAF_PREMIUM_CLB = "premium_clb"
WAF_ENTERPRISE_CLB = "enterprise_clb"
WAF_ULTIMATE_CLB = "ultimate_clb"
)

var WAF_CATEGORY_CLB = []string{
WAF_PREMIUM_CLB,
WAF_ENTERPRISE_CLB,
WAF_ULTIMATE_CLB,
}

const (
TIME_UINT_D = "d"
TIME_UINT_M = "m"
TIME_UINT_Y = "y"
)

var TIME_UNIT = []string{
TIME_UINT_D,
TIME_UINT_M,
TIME_UINT_Y,
}

const (
REGION_ID_MAINLAND = 1
REGION_ID_NON_MAINLAND = 9
)

var WAF_CATEGORY_ID_SAAS = map[string]int{
WAF_PREMIUM_SAAS: 102375,
WAF_ENTERPRISE_SAAS: 102378,
WAF_ULTIMATE_SAAS: 102369,
}

var SUB_PRODUCT_CODE_SAAS = map[string]string{
WAF_PREMIUM_SAAS: "sp_wsm_waf_premium",
WAF_ENTERPRISE_SAAS: "sp_wsm_waf_enterprise",
WAF_ULTIMATE_SAAS: "sp_wsm_waf_ultimate",
}

var PID_SAAS = map[string]int{
WAF_PREMIUM_SAAS: 1000827,
WAF_ENTERPRISE_SAAS: 1000830,
WAF_ULTIMATE_SAAS: 1000832,
}

var PKG_SAAS = map[string]int{
"DOMAIN": 1000834,
"QPS": 1000481,
}

var LABEL_TYPES_SAAS = map[string]string{
WAF_PREMIUM_SAAS: "sv_wsm_waf_package_premium",
WAF_ENTERPRISE_SAAS: "sv_wsm_waf_package_enterprise",
WAF_ULTIMATE_SAAS: "sv_wsm_waf_package_ultimate",
}

var LABEL_TYPES_CLB = map[string]string{
WAF_PREMIUM_CLB: "sv_wsm_waf_package_premium_clb",
WAF_ENTERPRISE_CLB: "sv_wsm_waf_package_enterprise_clb",
WAF_ULTIMATE_CLB: "sv_wsm_waf_package_ultimate_clb",
}

var WAF_CATEGORY_ID_CLB = map[string]int{
WAF_PREMIUM_CLB: 101198,
WAF_ENTERPRISE_CLB: 101204,
WAF_ULTIMATE_CLB: 101201,
}

var SUB_PRODUCT_CODE_CLB = map[string]string{
WAF_PREMIUM_CLB: "sp_wsm_waf_premium_clb",
WAF_ENTERPRISE_CLB: "sp_wsm_waf_enterprise_clb",
WAF_ULTIMATE_CLB: "sp_wsm_waf_ultimate_clb",
}

var PID_CLB = map[string]int{
WAF_PREMIUM_CLB: 1001150,
WAF_ENTERPRISE_CLB: 1001152,
WAF_ULTIMATE_CLB: 1001154,
}

const (
AUTO_RENEW_FLAG_0 = 0
AUTO_RENEW_FLAG_1 = 1
)

var AUTO_RENEW_FLAG = []int{
AUTO_RENEW_FLAG_0,
AUTO_RENEW_FLAG_1,
}

const (
ELASTIC_MODE_0 = 0
ELASTIC_MODE_1 = 1
)

var ELASTIC_MODE = []int{
ELASTIC_MODE_0,
ELASTIC_MODE_1,
}

const (
MAINLAND_0 = 0
MAINLAND_1 = 1
)

var MAINLAND = []int{
MAINLAND_0,
MAINLAND_1,
}

const (
DOMIAN_CATEGORY_ID_SAAS = 102372
DOMAIN_SUB_PRODUCT_CODE_SAAS = "sp_wsm_waf_domain"
DOMAIN_PID_SAAS = 1000834
DOMAIN_LABEL_TYPE_SAAS = "sv_wsm_waf_domain"
)

const (
QPS_CATEGORY_ID_SAAS = 101040
QPS_SUB_PRODUCT_CODE_SAAS = "sp_wsm_waf_qpsep"
QPS_PID_SAAS = 1000481
QPS_LABEL_TYPE_SAAS = "sv_wsm_waf_qps_ep"
)

const (
DOMIAN_CATEGORY_ID_CLB = 101207
DOMAIN_SUB_PRODUCT_CODE_CLB = "sp_wsm_waf_domain_clb"
DOMAIN_PID_CLB = 1001156
DOMAIN_LABEL_TYPE_CLB = "sv_wsm_waf_domain_clb"
)

const (
QPS_CATEGORY_ID_CLB = 101210
QPS_SUB_PRODUCT_CODE_CLB = "sp_wsm_waf_qpsep_clb"
QPS_PID_CLB = 1001160
QPS_LABEL_TYPE_CLB = "sv_wsm_waf_qps_ep_clb"
)

const (
SAAS_REAL_REGION_MAINLAND_GZ = "gz"
SAAS_REAL_REGION_MAINLAND_SH = "sh"
SAAS_REAL_REGION_MAINLAND_BJ = "bj"
SAAS_REAL_REGION_MAINLAND_CD = "cd"
)

var SAAS_REAL_REGION_MAINLAND = []string{
SAAS_REAL_REGION_MAINLAND_GZ,
SAAS_REAL_REGION_MAINLAND_SH,
SAAS_REAL_REGION_MAINLAND_BJ,
SAAS_REAL_REGION_MAINLAND_CD,
}

var SAAS_REAL_REGION_MAINLAND_ID_MAP = map[string]int{
SAAS_REAL_REGION_MAINLAND_GZ: 1,
SAAS_REAL_REGION_MAINLAND_SH: 4,
SAAS_REAL_REGION_MAINLAND_BJ: 8,
SAAS_REAL_REGION_MAINLAND_CD: 16,
}

const (
SAAS_REAL_REGION_NON_MAINLAND_HK = "hk"
SAAS_REAL_REGION_NON_MAINLAND_SG = "sg"
SAAS_REAL_REGION_NON_MAINLAND_TH = "th"
SAAS_REAL_REGION_NON_MAINLAND_KR = "kr"
SAAS_REAL_REGION_NON_MAINLAND_IN = "in"
SAAS_REAL_REGION_NON_MAINLAND_DE = "de"
SAAS_REAL_REGION_NON_MAINLAND_CA = "ca"
SAAS_REAL_REGION_NON_MAINLAND_USE = "use"
SAAS_REAL_REGION_NON_MAINLAND_SAO = "sao"
SAAS_REAL_REGION_NON_MAINLAND_USW = "usw"
SAAS_REAL_REGION_NON_MAINLAND_JKT = "jkt"
)

var SAAS_REAL_REGION_NON_MAINLAND = []string{
SAAS_REAL_REGION_NON_MAINLAND_HK,
SAAS_REAL_REGION_NON_MAINLAND_SG,
SAAS_REAL_REGION_NON_MAINLAND_TH,
SAAS_REAL_REGION_NON_MAINLAND_KR,
SAAS_REAL_REGION_NON_MAINLAND_IN,
SAAS_REAL_REGION_NON_MAINLAND_DE,
SAAS_REAL_REGION_NON_MAINLAND_CA,
SAAS_REAL_REGION_NON_MAINLAND_USE,
SAAS_REAL_REGION_NON_MAINLAND_SAO,
SAAS_REAL_REGION_NON_MAINLAND_USW,
SAAS_REAL_REGION_NON_MAINLAND_JKT,
}

var SAAS_REAL_REGION_NON_MAINLAND_ID_MAP = map[string]int{
SAAS_REAL_REGION_NON_MAINLAND_HK: 5,
SAAS_REAL_REGION_NON_MAINLAND_SG: 9,
SAAS_REAL_REGION_NON_MAINLAND_TH: 23,
SAAS_REAL_REGION_NON_MAINLAND_KR: 18,
SAAS_REAL_REGION_NON_MAINLAND_IN: 21,
SAAS_REAL_REGION_NON_MAINLAND_DE: 17,
SAAS_REAL_REGION_NON_MAINLAND_CA: 6,
SAAS_REAL_REGION_NON_MAINLAND_USE: 22,
SAAS_REAL_REGION_NON_MAINLAND_SAO: 42,
SAAS_REAL_REGION_NON_MAINLAND_USW: 51,
SAAS_REAL_REGION_NON_MAINLAND_JKT: 72,
}

var SAAS_REAL_REGIONS = append(SAAS_REAL_REGION_MAINLAND, SAAS_REAL_REGION_NON_MAINLAND...)
4 changes: 4 additions & 0 deletions tencentcloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,8 @@ Waf
tencentcloud_waf_custom_white_rule
tencentcloud_waf_clb_domain
tencentcloud_waf_saas_domain
tencentcloud_waf_clb_instance
tencentcloud_waf_saas_instance
*/
package tencentcloud

Expand Down Expand Up @@ -3076,6 +3078,8 @@ func Provider() *schema.Provider {
"tencentcloud_waf_custom_white_rule": resourceTencentCloudWafCustomWhiteRule(),
"tencentcloud_waf_clb_domain": resourceTencentCloudWafClbDomain(),
"tencentcloud_waf_saas_domain": resourceTencentCloudWafSaasDomain(),
"tencentcloud_waf_clb_instance": resourceTencentCloudWafClbInstance(),
"tencentcloud_waf_saas_instance": resourceTencentCloudWafSaasInstance(),
},

ConfigureFunc: providerConfigure,
Expand Down
Loading

0 comments on commit 64d8b91

Please sign in to comment.