3232 handle_client_error ,
3333 prettify_client_error )
3434
35- SECRETS_COLUMNS = ['key' , 'created_at' , 'updated_at' , 'visibility' ,
36- 'tenant_name' , 'created_by' , 'is_hidden_value' ]
35+ SECRETS_COLUMNS = [
36+ 'key' ,
37+ 'created_at' ,
38+ 'updated_at' ,
39+ 'visibility' ,
40+ 'tenant_name' ,
41+ 'created_by' ,
42+ 'is_hidden_value' ,
43+ 'provider_name' ,
44+ ]
3745
3846SECRET_PROVIDER_COLUMNS = [
3947 'name' ,
@@ -75,6 +83,7 @@ def providers():
7583@cfy .options .secret_flag_dict
7684@cfy .options .secret_flag_list
7785@cfy .options .tenant_name (required = False , resource_name_for_help = 'secret' )
86+ @cfy .options .provider
7887@cfy .options .common_options
7988@cfy .assert_manager_active ()
8089@cfy .pass_client (use_tenant_in_header = True )
@@ -89,6 +98,7 @@ def create(key,
8998 secret_flag_list ,
9099 visibility ,
91100 tenant_name ,
101+ provider ,
92102 logger ,
93103 client ):
94104 """Create a new secret (key-value pair)
@@ -127,12 +137,15 @@ def create(key,
127137 f'Error decoding secret value: \' { value } \' is not of '
128138 f'type \' { secret_schema .get ("type" )} \' ' )
129139
130- client .secrets .create (key ,
131- value ,
132- update_if_exists ,
133- hidden_value ,
134- visibility ,
135- secret_schema )
140+ client .secrets .create (
141+ key ,
142+ value ,
143+ update_if_exists ,
144+ hidden_value ,
145+ visibility ,
146+ secret_schema ,
147+ provider ,
148+ )
136149
137150 logger .info ('Secret `{0}` created' .format (key ))
138151
@@ -288,26 +301,43 @@ def update(key,
288301@cfy .options .search
289302@cfy .options .pagination_offset
290303@cfy .options .pagination_size
304+ @cfy .options .provider_multiple ()
291305@cfy .assert_manager_active ()
292306@cfy .pass_client ()
293307@cfy .pass_logger
294308@cfy .options .extended_view
295- def list (sort_by ,
296- descending ,
297- tenant_name ,
298- all_tenants ,
299- search ,
300- pagination_offset ,
301- pagination_size ,
302- logger ,
303- client ):
309+ def _list (
310+ sort_by ,
311+ descending ,
312+ tenant_name ,
313+ all_tenants ,
314+ search ,
315+ pagination_offset ,
316+ pagination_size ,
317+ provider ,
318+ logger ,
319+ client ,
320+ ):
304321 """List all secrets
305322 """
323+ filter_rules = None
324+
325+ if provider :
326+ filter_rules = [
327+ {
328+ "key" : "provider_name" ,
329+ "values" : provider ,
330+ "operator" : "starts_with" ,
331+ "type" : "attribute" ,
332+ }
333+ ]
334+
306335 utils .explicit_tenant_name_message (tenant_name , logger )
307336 logger .info ('Listing all secrets...' )
308337 secrets_list = client .secrets .list (
309338 sort = sort_by ,
310339 is_descending = descending ,
340+ filter_rules = filter_rules ,
311341 _all_tenants = all_tenants ,
312342 _search = search ,
313343 _offset = pagination_offset ,
0 commit comments