Skip to content

Commit 1037f08

Browse files
laoyigracefranklwyLiu Wenyuashorezfc11zyw0599
authored
Feature/swr (#156)
* Add files via upload add huaweicloud Kafka custodian * Changes set-config Delete json-diff * delete import * rename set_config * Feature/dns (#9) add dns actions, filters, UTs * Feature/dns (#10) * add readme_dns * add readme_dns * add readme_dns * Update readme_dns.md * Update readme_dns.md * add dns * update readme_dns * update kafka * update client * update dns * update dns * update dns add dns_test * update dns_test update mock * add mock * update dns * Delete tools/c7n_huaweicloud/c7n_huaweicloud/resources/dns_files directory * update dns lint * lint modify * lint modify * modify * modify * update test --------- Co-authored-by: Liu Wenyu <[email protected]> * Create readme_dns.md * feat:swr服务开发提交 * unittest complete * feat:DMS for RocketMQ服务开发 * feat:mock文件提交 * feat:修改swr查询resource报错问题 * feat:修改swr-image无法过滤的问题 * fix:修改SwrImage没有正确过滤的问题 * fix:修复创建老化规则失败的问题 * fix:修复security-group过滤不出来的问题 * 修复lint失败的问题 * fix:lint门禁处理 * fix:lint门禁修改 * fix:lint门禁修改 * fix:lint门禁修改 * fix:lint门禁修复 * fix:修复时间过滤错误的问题及格式化代码 * fix:lint门禁修改 * fix:lint门禁修改 * fix:lint门禁修改 * fix:poetry lock执行 * fix:镜像源添加 * fix:删除dns文件 * fix:修改mock文件 * fix:lint门禁修改 * fix: invalid query * fix:test门禁修改 * fix: delete volume * fix: remove common actions and filters * feat:还原ageFilter功能 * feat:恢复tag相关的代码 * Update ci.yml * delete dns readme * fix: remove redundant filter/action * modify ramRegion * 去掉mirror源 * fix: unit tests passed * refactor:rename rocketmq * fix: rm dns related * fix: format1 * fix: format2 * fix: format3 * fix: poetry lock update * fix: policy validate * fix: pagination * fix: swr-image * refactor: delete nonsense * fix: remove redundant import * fix: lint * fix: remove whitespace * fix: remove additional whitespace * fix: lifecycle filter search * fix: poetry.lock * fix: remove mirror * Revert "Merge branch 'huaweicloudmain' into feature/SWR" This reverts commit e12f01f, reversing changes made to 123da86. * fix: remove poetry mirrors * fix: remove redundant file * fix: complete all files * Update ci.yml * fix: change english * Update mu.py * Update mu.py --------- Co-authored-by: franklwy <[email protected]> Co-authored-by: Liu Wenyu <[email protected]> Co-authored-by: zfc1996 <[email protected]> Co-authored-by: zyw0599 <[email protected]> Co-authored-by: CuiLeiyang <[email protected]>
1 parent 8b715e6 commit 1037f08

File tree

11 files changed

+671
-511
lines changed

11 files changed

+671
-511
lines changed

tools/c7n_huaweicloud/c7n_huaweicloud/resources/swr.py

Lines changed: 214 additions & 176 deletions
Large diffs are not rendered by default.

tools/c7n_huaweicloud/tests/data/flights/swr_filter_age

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interactions:
1111
User-Agent:
1212
- python-requests/2.29.0
1313
method: GET
14-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
14+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
1515
response:
1616
body:
1717
string: '[{"name":"test-repo","category":"app","size":102400,"is_public":false,"num_images":1,"num_download":10,"url":"https://swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","internal_path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","domain_name":"test-namespace","namespace":"test-namespace","created_at":"2022-01-01T00:00:00Z"}]'
@@ -85,7 +85,7 @@ interactions:
8585
X-Sdk-Date:
8686
- 20250513T021558Z
8787
method: GET
88-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
88+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
8989
response:
9090
body:
9191
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"1bddfccabcb9ee546f5940e48820aca0"}

tools/c7n_huaweicloud/tests/data/flights/swr_filter_lifecycle_rule_match

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interactions:
1919
X-Sdk-Date:
2020
- 20250430T022319Z
2121
method: GET
22-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
22+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
2323
response:
2424
body:
2525
string: '[ { "name": "test-repo", "category": "linux", "description": "Test
@@ -86,59 +86,4 @@ interactions:
8686
status:
8787
code: 200
8888
message: OK
89-
- request:
90-
body: null
91-
headers:
92-
Accept:
93-
- '*/*'
94-
Accept-Encoding:
95-
- gzip, deflate
96-
Connection:
97-
- keep-alive
98-
Content-Type:
99-
- application/json
100-
Host:
101-
- swr-api.ap-southeast-1.myhuaweicloud.com
102-
User-Agent:
103-
- huaweicloud-usdk-python/3.0
104-
X-Project-Id:
105-
- ap-southeat-1
106-
X-Sdk-Date:
107-
- 20250513T021558Z
108-
method: GET
109-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
110-
response:
111-
body:
112-
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"ba6d6443d4ad1f2b2bd2c934dddf43dc"}
113-
114-
'
115-
headers:
116-
Connection:
117-
- keep-alive
118-
Content-Type:
119-
- application/json
120-
Date:
121-
- Tue, 13 May 2025 02:15:59 GMT
122-
Server:
123-
- CloudWAF
124-
Set-Cookie:
125-
- HWWAFSESTIME=1747102559091; path=/
126-
- HWWAFSESID=9947973e39bea8b9d2; path=/
127-
Strict-Transport-Security:
128-
- max-age=31536000; includeSubdomains;
129-
Transfer-Encoding:
130-
- chunked
131-
X-Content-Type-Options:
132-
- nosniff
133-
X-Download-Options:
134-
- noopen
135-
X-Frame-Options:
136-
- SAMEORIGIN
137-
X-Request-Id:
138-
- ba6d6443d4ad1f2b2bd2c934dddf43dc
139-
X-XSS-Protection:
140-
- 1; mode=block;
141-
status:
142-
code: 401
143-
message: Unauthorized
14489
version: 1

tools/c7n_huaweicloud/tests/data/flights/swr_filter_lifecycle_rule_no_match

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interactions:
1919
X-Sdk-Date:
2020
- 20250430T022319Z
2121
method: GET
22-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
22+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
2323
response:
2424
body:
2525
string: '[ { "name": "test-repo", "category": "linux", "description": "Test
@@ -83,59 +83,4 @@ interactions:
8383
status:
8484
code: 200
8585
message: OK
86-
- request:
87-
body: null
88-
headers:
89-
Accept:
90-
- '*/*'
91-
Accept-Encoding:
92-
- gzip, deflate
93-
Connection:
94-
- keep-alive
95-
Content-Type:
96-
- application/json
97-
Host:
98-
- swr-api.ap-southeast-1.myhuaweicloud.com
99-
User-Agent:
100-
- huaweicloud-usdk-python/3.0
101-
X-Project-Id:
102-
- ap-southeat-1
103-
X-Sdk-Date:
104-
- 20250513T021559Z
105-
method: GET
106-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
107-
response:
108-
body:
109-
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"ee566d83797f134183dae2c5cf0a4fa5"}
110-
111-
'
112-
headers:
113-
Connection:
114-
- keep-alive
115-
Content-Type:
116-
- application/json
117-
Date:
118-
- Tue, 13 May 2025 02:15:59 GMT
119-
Server:
120-
- CloudWAF
121-
Set-Cookie:
122-
- HWWAFSESTIME=1747102559245; path=/
123-
- HWWAFSESID=f583273f033b723c51; path=/
124-
Strict-Transport-Security:
125-
- max-age=31536000; includeSubdomains;
126-
Transfer-Encoding:
127-
- chunked
128-
X-Content-Type-Options:
129-
- nosniff
130-
X-Download-Options:
131-
- noopen
132-
X-Frame-Options:
133-
- SAMEORIGIN
134-
X-Request-Id:
135-
- ee566d83797f134183dae2c5cf0a4fa5
136-
X-XSS-Protection:
137-
- 1; mode=block;
138-
status:
139-
code: 401
140-
message: Unauthorized
14186
version: 1

tools/c7n_huaweicloud/tests/data/flights/swr_filter_value

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interactions:
1111
User-Agent:
1212
- python-requests/2.29.0
1313
method: GET
14-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
14+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
1515
response:
1616
body:
1717
string: '[{"name":"test-repo","category":"app","size":102400,"is_public":false,"num_images":1,"num_download":10,"url":"https://swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","internal_path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","domain_name":"test-namespace","namespace":"test-namespace","created_at":"2023-01-01T00:00:00Z"}]'
@@ -64,60 +64,4 @@ interactions:
6464
- f7de4aaa5ab48bb66bf012584aad5f6a
6565
status:
6666
code: 200
67-
message: OK
68-
- request:
69-
body: null
70-
headers:
71-
Accept:
72-
- '*/*'
73-
Accept-Encoding:
74-
- gzip, deflate
75-
Connection:
76-
- keep-alive
77-
Content-Type:
78-
- application/json
79-
Host:
80-
- swr-api.ap-southeast-1.myhuaweicloud.com
81-
User-Agent:
82-
- huaweicloud-usdk-python/3.0
83-
X-Project-Id:
84-
- ap-southeat-1
85-
X-Sdk-Date:
86-
- 20250513T021558Z
87-
method: GET
88-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
89-
response:
90-
body:
91-
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"b5b24babefd93500c88bc258b66c9460"}
92-
93-
'
94-
headers:
95-
Connection:
96-
- keep-alive
97-
Content-Type:
98-
- application/json
99-
Date:
100-
- Tue, 13 May 2025 02:15:58 GMT
101-
Server:
102-
- CloudWAF
103-
Set-Cookie:
104-
- HWWAFSESID=a105679140f7500ef3; path=/
105-
- HWWAFSESTIME=1747102556286; path=/
106-
Strict-Transport-Security:
107-
- max-age=31536000; includeSubdomains;
108-
Transfer-Encoding:
109-
- chunked
110-
X-Content-Type-Options:
111-
- nosniff
112-
X-Download-Options:
113-
- noopen
114-
X-Frame-Options:
115-
- SAMEORIGIN
116-
X-Request-Id:
117-
- b5b24babefd93500c88bc258b66c9460
118-
X-XSS-Protection:
119-
- 1; mode=block;
120-
status:
121-
code: 401
122-
message: Unauthorized
123-
version: 1
67+
message: OK

tools/c7n_huaweicloud/tests/data/flights/swr_image_filter_age

Lines changed: 115 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ interactions:
1919
X-Sdk-Date:
2020
- 20240430T012508Z
2121
method: GET
22-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos
22+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/repos?limit=100&offset=0
2323
response:
2424
body:
25-
string: '[{"id":235,"name":"test-repo","namespace":"test-namespace","category":"other","description":"Test repository","size":25678,"is_public":false,"num_images":1,"num_download":0,"create_time":"2022-01-01T00:00:00Z","url":"https://swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","internal_path":"100.125.0.28:20202/test-namespace/test-repo","domain":"100.125.0.28:20202","creator_name":"user","status":true},{"id":237,"name":"new-repo","namespace":"new-namespace","category":"other","description":"New repository","size":15678,"is_public":false,"num_images":2,"num_download":5,"create_time":"2023-10-01T00:00:00Z","url":"https://swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo","internal_path":"100.125.0.28:20202/new-namespace/new-repo","domain":"100.125.0.28:20202","creator_name":"new-user","status":true}]'
25+
string: '[{"id":235,"name":"test-repo","namespace":"test-namespace","category":"other","description":"Test
26+
repository","size":25678,"is_public":false,"num_images":1,"num_download":0,"create_time":"2022-01-01T00:00:00Z","url":"https://swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo","internal_path":"100.125.0.28:20202/test-namespace/test-repo","domain":"100.125.0.28:20202","creator_name":"user","status":true},{"id":237,"name":"new-repo","namespace":"new-namespace","category":"other","description":"New
27+
repository","size":15678,"is_public":false,"num_images":2,"num_download":5,"create_time":"2023-10-01T00:00:00Z","url":"https://swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo","path":"swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo","internal_path":"100.125.0.28:20202/new-namespace/new-repo","domain":"100.125.0.28:20202","creator_name":"new-user","status":true}]'
2628
headers:
2729
Connection:
2830
- keep-alive
@@ -57,7 +59,7 @@ interactions:
5759
X-Sdk-Date:
5860
- 20240430T012508Z
5961
method: GET
60-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/test-namespace/repos/test-repo/tags
62+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/test-namespace/repos/test-repo/tags?limit=100&offset=0
6163
response:
6264
body:
6365
string: '[{"id":124,"Tag":"v1.0.0","image_id":"sha256:1234567890abcdef","digest":"sha256:abcdef1234567890","path":"swr.ap-southeast-1.myhuaweicloud.com/test-namespace/test-repo:v1.0.0","created":"2022-01-01T00:00:00Z","updated":"2022-01-01T00:00:00Z","is_trusted":false,"namespace":"test-namespace","repository":"test-repo"}]'
@@ -95,7 +97,7 @@ interactions:
9597
X-Sdk-Date:
9698
- 20240430T012509Z
9799
method: GET
98-
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/new-namespace/repos/new-repo/tags
100+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/new-namespace/repos/new-repo/tags?limit=100&offset=0
99101
response:
100102
body:
101103
string: '[{"id":125,"Tag":"latest","image_id":"sha256:5234567890abcdef","digest":"sha256:dbcdef1234567890","path":"swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo:latest","created":"2023-10-01T00:00:00Z","updated":"2023-10-01T00:00:00Z","is_trusted":false,"namespace":"new-namespace","repository":"new-repo"},{"id":126,"Tag":"v1.0.0","image_id":"sha256:6234567890abcdef","digest":"sha256:ebcdef1234567890","path":"swr.ap-southeast-1.myhuaweicloud.com/new-namespace/new-repo:v1.0.0","created":"2023-11-01T00:00:00Z","updated":"2023-11-01T00:00:00Z","is_trusted":false,"namespace":"new-namespace","repository":"new-repo"}]'
@@ -113,4 +115,113 @@ interactions:
113115
status:
114116
code: 200
115117
message: OK
118+
- request:
119+
body: null
120+
headers:
121+
Accept:
122+
- '*/*'
123+
Accept-Encoding:
124+
- gzip, deflate
125+
Connection:
126+
- keep-alive
127+
Content-Type:
128+
- application/json
129+
Host:
130+
- swr-api.ap-southeast-1.myhuaweicloud.com
131+
User-Agent:
132+
- huaweicloud-usdk-python/3.0
133+
X-Project-Id:
134+
- ap-southeat-1
135+
X-Sdk-Date:
136+
- 20250515T083816Z
137+
method: GET
138+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/test-namespace/repos/test-repo/retentions
139+
response:
140+
body:
141+
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"d3971b3df387ee9963d4716d65cc9556"}
142+
143+
'
144+
headers:
145+
Connection:
146+
- keep-alive
147+
Content-Type:
148+
- application/json
149+
Date:
150+
- Thu, 15 May 2025 08:38:16 GMT
151+
Server:
152+
- CloudWAF
153+
Set-Cookie:
154+
- HWWAFSESID=9e25c7368849c2eb27; path=/
155+
- HWWAFSESTIME=1747298296175; path=/
156+
Strict-Transport-Security:
157+
- max-age=31536000; includeSubdomains;
158+
Transfer-Encoding:
159+
- chunked
160+
X-Content-Type-Options:
161+
- nosniff
162+
X-Download-Options:
163+
- noopen
164+
X-Frame-Options:
165+
- SAMEORIGIN
166+
X-Request-Id:
167+
- d3971b3df387ee9963d4716d65cc9556
168+
X-XSS-Protection:
169+
- 1; mode=block;
170+
status:
171+
code: 401
172+
message: Unauthorized
173+
- request:
174+
body: null
175+
headers:
176+
Accept:
177+
- '*/*'
178+
Accept-Encoding:
179+
- gzip, deflate
180+
Connection:
181+
- keep-alive
182+
Content-Type:
183+
- application/json
184+
Cookie:
185+
- HWWAFSESID=9e25c7368849c2eb27; HWWAFSESTIME=1747298296175
186+
Host:
187+
- swr-api.ap-southeast-1.myhuaweicloud.com
188+
User-Agent:
189+
- huaweicloud-usdk-python/3.0
190+
X-Project-Id:
191+
- ap-southeat-1
192+
X-Sdk-Date:
193+
- 20250515T083816Z
194+
method: GET
195+
uri: https://swr-api.ap-southeast-1.myhuaweicloud.com/v2/manage/namespaces/new-namespace/repos/new-repo/retentions
196+
response:
197+
body:
198+
string: '{"error_msg":"Incorrect IAM authentication information: Unauthorized","error_code":"APIGW.0301","request_id":"82ffc356b6582c523a4b20633848adb2"}
199+
200+
'
201+
headers:
202+
Connection:
203+
- keep-alive
204+
Content-Type:
205+
- application/json
206+
Date:
207+
- Thu, 15 May 2025 08:38:16 GMT
208+
Server:
209+
- CloudWAF
210+
Strict-Transport-Security:
211+
- max-age=31536000; includeSubdomains;
212+
Transfer-Encoding:
213+
- chunked
214+
X-Content-Type-Options:
215+
- nosniff
216+
X-Download-Options:
217+
- noopen
218+
X-Frame-Options:
219+
- SAMEORIGIN
220+
X-Request-Id:
221+
- 82ffc356b6582c523a4b20633848adb2
222+
X-XSS-Protection:
223+
- 1; mode=block;
224+
status:
225+
code: 401
226+
message: Unauthorized
116227
version: 1

0 commit comments

Comments
 (0)