2525REST Kind
2626 ``tm:sys:config:*``
2727"""
28-
28+ from f5 . bigip . mixins import CommandExecutionMixin
2929from f5 .bigip .resource import Collection
3030from f5 .bigip .resource import OrganizingCollection
3131from f5 .bigip .resource import Resource
@@ -40,49 +40,67 @@ def __init__(self, sys):
4040 ]
4141
4242
43- class Keys (Collection ):
43+ class Keys (Collection , CommandExecutionMixin ):
44+ """BIG-IP® Crypto key collection
45+
46+
47+ note::
48+ This collection supports install command.
49+ Given the fact that we will be expecting hyphen
50+ parameters, the function will need to utilize
51+ variable keyword argument syntax. In other words
52+ define a dictionary with the arbitrary keys and
53+ then pass it as in the form **foo into the method
54+ call. e.g.
55+
56+ param_set ={'from-local-file': FOOPATH, 'name': 'FOOKEY'}
57+ bigip.tm.sys.crypto.keys.exec_cmd('install', **param_set)
58+
59+
60+ """
4461 def __init__ (self , crypto ):
4562 super (Keys , self ).__init__ (crypto )
46- self ._meta_data ['allowed_lazy_attributes' ] = [
47- Key
48- ]
63+ self ._meta_data ['allowed_lazy_attributes' ] = [Key ]
64+ self ._meta_data ['allowed_commands' ].append ('install' )
4965 self ._meta_data ['attribute_registry' ] = \
5066 {'tm:sys:crypto:key:keystate' : Key }
5167
52- def install_key (self , certfilename , keyfilename ):
53- payload = \
54- {"from-local-file" : "/var/config/rest/downloads/%s" % keyfilename ,
55- "command" : "install" ,
56- "name" : certfilename [:- 4 ]}
57- self ._meta_data ['icr_session' ].post (self ._meta_data ['uri' ],
58- json = payload )
59-
6068
6169class Key (Resource ):
70+ """BIG-IP® Crypto key resource"""
6271 def __init__ (self , keys ):
6372 super (Key , self ).__init__ (keys )
6473 self ._meta_data ['required_json_kind' ] = 'tm:sys:crypto:key:keystate'
6574
6675
67- class Certs (Collection ):
76+ class Certs (Collection , CommandExecutionMixin ):
77+ """BIG-IP® Crypto cert collection
78+
79+
80+ note::
81+ This collection supports install command.
82+ Given the fact that we will be expecting hyphen
83+ parameters, the function will need to utilize
84+ variable keyword argument syntax. In other words
85+ define a dictionary with the arbitrary keys and
86+ then pass it as in the form **foo into the method
87+ call. e.g.
88+
89+ param_set ={'from-local-file': FOOPATH, 'name': 'FOOCERT'}
90+ bigip.tm.sys.crypto.certs.exec_cmd('install', **param_set)
91+
92+
93+ """
6894 def __init__ (self , crypto ):
6995 super (Certs , self ).__init__ (crypto )
70- self ._meta_data ['allowed_lazy_attributes' ] = [
71- Cert
72- ]
96+ self ._meta_data ['allowed_lazy_attributes' ] = [Cert ]
97+ self ._meta_data ['allowed_commands' ].append ('install' )
7398 self ._meta_data ['attribute_registry' ] = \
7499 {'tm:sys:crypto:cert:certstate' : Cert }
75100
76- def install_cert (self , certfilename ):
77- payload = \
78- {"from-local-file" : "/var/config/rest/downloads/%s" % certfilename ,
79- "command" : "install" ,
80- "name" : certfilename [:- 4 ]}
81- self ._meta_data ['icr_session' ].post (self ._meta_data ['uri' ],
82- json = payload )
83-
84101
85102class Cert (Resource ):
103+ """BIG-IP® Crypto cert resource"""
86104 def __init__ (self , certs ):
87105 super (Cert , self ).__init__ (certs )
88106 self ._meta_data ['required_json_kind' ] = 'tm:sys:crypto:cert:certstate'
0 commit comments