14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
16
17
- # IBM OpenAPI SDK Code Generator Version: 3.29 .0-cd9ba74f-20210305-183535
17
+ # IBM OpenAPI SDK Code Generator Version: 3.30 .0-bd714324-20210406-200538
18
18
19
19
"""
20
20
With IBM Cloud® Secrets Manager, you can create, lease, and centrally manage secrets that
30
30
from ibm_cloud_sdk_core import BaseService , DetailedResponse
31
31
from ibm_cloud_sdk_core .authenticators .authenticator import Authenticator
32
32
from ibm_cloud_sdk_core .get_authenticator import get_authenticator_from_environment
33
- from ibm_cloud_sdk_core .utils import convert_model , datetime_to_string , string_to_datetime
33
+ from ibm_cloud_sdk_core .utils import convert_list , convert_model , datetime_to_string , string_to_datetime
34
34
35
35
from .common import get_sdk_headers
36
36
@@ -100,6 +100,8 @@ def put_config(self,
100
100
raise ValueError ('secret_type must be provided' )
101
101
if engine_config_one_of is None :
102
102
raise ValueError ('engine_config_one_of must be provided' )
103
+ if isinstance (engine_config_one_of , EngineConfigOneOf ):
104
+ engine_config_one_of = convert_model (engine_config_one_of )
103
105
headers = {}
104
106
sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
105
107
service_version = 'V1' ,
@@ -136,7 +138,7 @@ def get_config(self,
136
138
:param str secret_type: The secret type.
137
139
:param dict headers: A `dict` containing the request headers
138
140
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
139
- :rtype: DetailedResponse with `dict` result representing a `EngineConfigOneOf ` object
141
+ :rtype: DetailedResponse with `dict` result representing a `GetConfig ` object
140
142
"""
141
143
142
144
if secret_type is None :
@@ -653,6 +655,7 @@ def list_all_secrets(self,
653
655
offset : int = None ,
654
656
search : str = None ,
655
657
sort_by : str = None ,
658
+ groups : List [str ] = None ,
656
659
** kwargs
657
660
) -> DetailedResponse :
658
661
"""
@@ -682,6 +685,13 @@ def list_all_secrets(self,
682
685
field.
683
686
**Usage:** To sort a list of secrets by their creation date, use
684
687
`../secrets/{secret-type}?sort_by=creation_date`.
688
+ :param List[str] groups: (optional) Filter secrets by groups.
689
+ You can apply multiple filters by using a comma-separated list of secret
690
+ group IDs. If you need to filter secrets that are in the default secret
691
+ group, use the `default` keyword.
692
+ **Usage:** To retrieve a list of secrets that are associated with an
693
+ existing secret group or the default group, use
694
+ `../secrets?groups={secret_group_ID},default`.
685
695
:param dict headers: A `dict` containing the request headers
686
696
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
687
697
:rtype: DetailedResponse with `dict` result representing a `ListSecrets` object
@@ -697,7 +707,8 @@ def list_all_secrets(self,
697
707
'limit' : limit ,
698
708
'offset' : offset ,
699
709
'search' : search ,
700
- 'sort_by' : sort_by
710
+ 'sort_by' : sort_by ,
711
+ 'groups' : convert_list (groups )
701
712
}
702
713
703
714
if 'headers' in kwargs :
@@ -777,7 +788,7 @@ def update_secret(self,
777
788
:param str secret_type: The secret type.
778
789
:param str id: The v4 UUID that uniquely identifies the secret.
779
790
:param str action: The action to perform on the specified secret.
780
- :param SecretActionOneOf secret_action_one_of: The base request for
791
+ :param SecretActionOneOf secret_action_one_of: The base request body for
781
792
invoking an action on a secret.
782
793
:param dict headers: A `dict` containing the request headers
783
794
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
@@ -792,6 +803,8 @@ def update_secret(self,
792
803
raise ValueError ('action must be provided' )
793
804
if secret_action_one_of is None :
794
805
raise ValueError ('secret_action_one_of must be provided' )
806
+ if isinstance (secret_action_one_of , SecretActionOneOf ):
807
+ secret_action_one_of = convert_model (secret_action_one_of )
795
808
headers = {}
796
809
sdk_headers = get_sdk_headers (service_name = self .DEFAULT_SERVICE_NAME ,
797
810
service_version = 'V1' ,
@@ -1329,6 +1342,76 @@ def __init__(self) -> None:
1329
1342
raise Exception (msg )
1330
1343
1331
1344
1345
+ class GetConfig ():
1346
+ """
1347
+ Configuration that is used to generate IAM credentials.
1348
+
1349
+ :attr CollectionMetadata metadata: The metadata that describes the resource
1350
+ array.
1351
+ :attr List[IAMSecretEngineRootConfig] resources: A collection of resources.
1352
+ """
1353
+
1354
+ def __init__ (self ,
1355
+ metadata : 'CollectionMetadata' ,
1356
+ resources : List ['IAMSecretEngineRootConfig' ]) -> None :
1357
+ """
1358
+ Initialize a GetConfig object.
1359
+
1360
+ :param CollectionMetadata metadata: The metadata that describes the
1361
+ resource array.
1362
+ :param List[IAMSecretEngineRootConfig] resources: A collection of
1363
+ resources.
1364
+ """
1365
+ self .metadata = metadata
1366
+ self .resources = resources
1367
+
1368
+ @classmethod
1369
+ def from_dict (cls , _dict : Dict ) -> 'GetConfig' :
1370
+ """Initialize a GetConfig object from a json dictionary."""
1371
+ args = {}
1372
+ if 'metadata' in _dict :
1373
+ args ['metadata' ] = CollectionMetadata .from_dict (_dict .get ('metadata' ))
1374
+ else :
1375
+ raise ValueError ('Required property \' metadata\' not present in GetConfig JSON' )
1376
+ if 'resources' in _dict :
1377
+ args ['resources' ] = [IAMSecretEngineRootConfig .from_dict (x ) for x in _dict .get ('resources' )]
1378
+ else :
1379
+ raise ValueError ('Required property \' resources\' not present in GetConfig JSON' )
1380
+ return cls (** args )
1381
+
1382
+ @classmethod
1383
+ def _from_dict (cls , _dict ):
1384
+ """Initialize a GetConfig object from a json dictionary."""
1385
+ return cls .from_dict (_dict )
1386
+
1387
+ def to_dict (self ) -> Dict :
1388
+ """Return a json dictionary representing this model."""
1389
+ _dict = {}
1390
+ if hasattr (self , 'metadata' ) and self .metadata is not None :
1391
+ _dict ['metadata' ] = self .metadata .to_dict ()
1392
+ if hasattr (self , 'resources' ) and self .resources is not None :
1393
+ _dict ['resources' ] = [x .to_dict () for x in self .resources ]
1394
+ return _dict
1395
+
1396
+ def _to_dict (self ):
1397
+ """Return a json dictionary representing this model."""
1398
+ return self .to_dict ()
1399
+
1400
+ def __str__ (self ) -> str :
1401
+ """Return a `str` version of this GetConfig object."""
1402
+ return json .dumps (self .to_dict (), indent = 2 )
1403
+
1404
+ def __eq__ (self , other : 'GetConfig' ) -> bool :
1405
+ """Return `true` when self and other are equal, false otherwise."""
1406
+ if not isinstance (other , self .__class__ ):
1407
+ return False
1408
+ return self .__dict__ == other .__dict__
1409
+
1410
+ def __ne__ (self , other : 'GetConfig' ) -> bool :
1411
+ """Return `true` when self and other are not equal, false otherwise."""
1412
+ return not self == other
1413
+
1414
+
1332
1415
class GetSecret ():
1333
1416
"""
1334
1417
The base schema for retrieving a secret.
@@ -1551,6 +1634,82 @@ class TypeEnum(str, Enum):
1551
1634
APPLICATION_VND_IBM_SECRETS_MANAGER_SECRET_POLICY_JSON = 'application/vnd.ibm.secrets-manager.secret.policy+json'
1552
1635
1553
1636
1637
+ class IAMSecretEngineRootConfig ():
1638
+ """
1639
+ Configuration that is used to generate IAM credentials.
1640
+
1641
+ :attr str api_key: An IBM Cloud API key that has the capability to create and
1642
+ manage service IDs.
1643
+ The API key must be assigned the Editor platform role on the Access Groups
1644
+ Service and the Operator platform role on the IAM Identity Service. For more
1645
+ information, see [Enabling the IAM secrets
1646
+ engine](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secret-engines#configure-iam-engine).
1647
+ :attr str api_key_hash: (optional) The hash value of the IBM Cloud API key that
1648
+ is used to create and manage service IDs.
1649
+ """
1650
+
1651
+ def __init__ (self ,
1652
+ api_key : str ,
1653
+ * ,
1654
+ api_key_hash : str = None ) -> None :
1655
+ """
1656
+ Initialize a IAMSecretEngineRootConfig object.
1657
+
1658
+ :param str api_key: An IBM Cloud API key that has the capability to create
1659
+ and manage service IDs.
1660
+ The API key must be assigned the Editor platform role on the Access Groups
1661
+ Service and the Operator platform role on the IAM Identity Service. For
1662
+ more information, see [Enabling the IAM secrets
1663
+ engine](https://cloud.ibm.com/docs/secrets-manager?topic=secrets-manager-secret-engines#configure-iam-engine).
1664
+ """
1665
+ self .api_key = api_key
1666
+ self .api_key_hash = api_key_hash
1667
+
1668
+ @classmethod
1669
+ def from_dict (cls , _dict : Dict ) -> 'IAMSecretEngineRootConfig' :
1670
+ """Initialize a IAMSecretEngineRootConfig object from a json dictionary."""
1671
+ args = {}
1672
+ if 'api_key' in _dict :
1673
+ args ['api_key' ] = _dict .get ('api_key' )
1674
+ else :
1675
+ raise ValueError ('Required property \' api_key\' not present in IAMSecretEngineRootConfig JSON' )
1676
+ if 'api_key_hash' in _dict :
1677
+ args ['api_key_hash' ] = _dict .get ('api_key_hash' )
1678
+ return cls (** args )
1679
+
1680
+ @classmethod
1681
+ def _from_dict (cls , _dict ):
1682
+ """Initialize a IAMSecretEngineRootConfig object from a json dictionary."""
1683
+ return cls .from_dict (_dict )
1684
+
1685
+ def to_dict (self ) -> Dict :
1686
+ """Return a json dictionary representing this model."""
1687
+ _dict = {}
1688
+ if hasattr (self , 'api_key' ) and self .api_key is not None :
1689
+ _dict ['api_key' ] = self .api_key
1690
+ if hasattr (self , 'api_key_hash' ) and getattr (self , 'api_key_hash' ) is not None :
1691
+ _dict ['api_key_hash' ] = getattr (self , 'api_key_hash' )
1692
+ return _dict
1693
+
1694
+ def _to_dict (self ):
1695
+ """Return a json dictionary representing this model."""
1696
+ return self .to_dict ()
1697
+
1698
+ def __str__ (self ) -> str :
1699
+ """Return a `str` version of this IAMSecretEngineRootConfig object."""
1700
+ return json .dumps (self .to_dict (), indent = 2 )
1701
+
1702
+ def __eq__ (self , other : 'IAMSecretEngineRootConfig' ) -> bool :
1703
+ """Return `true` when self and other are equal, false otherwise."""
1704
+ if not isinstance (other , self .__class__ ):
1705
+ return False
1706
+ return self .__dict__ == other .__dict__
1707
+
1708
+ def __ne__ (self , other : 'IAMSecretEngineRootConfig' ) -> bool :
1709
+ """Return `true` when self and other are not equal, false otherwise."""
1710
+ return not self == other
1711
+
1712
+
1554
1713
class ListSecrets ():
1555
1714
"""
1556
1715
The base schema for listing secrets.
@@ -1942,6 +2101,11 @@ class SecretMetadata():
1942
2101
For `iam_credentials` secrets, the TTL defines for how long each generated API
1943
2102
key remains valid. The value can be either an integer that specifies the number
1944
2103
of seconds, or the string representation of a duration, such as `120m` or `24h`.
2104
+ :attr bool reuse_api_key: (optional) For `iam_credentials` secrets, this field
2105
+ controls whether to use the same service ID and API key for future read
2106
+ operations on this secret. If set to `true`, the service reuses the current
2107
+ credentials. If set to `false`, a new service ID and API key is generated each
2108
+ time that the secret is read or accessed.
1945
2109
:attr str crn: (optional) The Cloud Resource Name (CRN) that uniquely identifies
1946
2110
the resource.
1947
2111
:attr datetime creation_date: (optional) The date the secret was created. The
@@ -1964,6 +2128,7 @@ def __init__(self,
1964
2128
secret_type : str = None ,
1965
2129
expiration_date : datetime = None ,
1966
2130
ttl : object = None ,
2131
+ reuse_api_key : bool = None ,
1967
2132
crn : str = None ,
1968
2133
creation_date : datetime = None ,
1969
2134
created_by : str = None ,
@@ -2009,6 +2174,7 @@ def __init__(self,
2009
2174
self .secret_type = secret_type
2010
2175
self .expiration_date = expiration_date
2011
2176
self .ttl = ttl
2177
+ self .reuse_api_key = reuse_api_key
2012
2178
self .crn = crn
2013
2179
self .creation_date = creation_date
2014
2180
self .created_by = created_by
@@ -2040,6 +2206,8 @@ def from_dict(cls, _dict: Dict) -> 'SecretMetadata':
2040
2206
args ['expiration_date' ] = string_to_datetime (_dict .get ('expiration_date' ))
2041
2207
if 'ttl' in _dict :
2042
2208
args ['ttl' ] = _dict .get ('ttl' )
2209
+ if 'reuse_api_key' in _dict :
2210
+ args ['reuse_api_key' ] = _dict .get ('reuse_api_key' )
2043
2211
if 'crn' in _dict :
2044
2212
args ['crn' ] = _dict .get ('crn' )
2045
2213
if 'creation_date' in _dict :
@@ -2078,6 +2246,8 @@ def to_dict(self) -> Dict:
2078
2246
_dict ['expiration_date' ] = datetime_to_string (self .expiration_date )
2079
2247
if hasattr (self , 'ttl' ) and self .ttl is not None :
2080
2248
_dict ['ttl' ] = self .ttl
2249
+ if hasattr (self , 'reuse_api_key' ) and getattr (self , 'reuse_api_key' ) is not None :
2250
+ _dict ['reuse_api_key' ] = getattr (self , 'reuse_api_key' )
2081
2251
if hasattr (self , 'crn' ) and getattr (self , 'crn' ) is not None :
2082
2252
_dict ['crn' ] = getattr (self , 'crn' )
2083
2253
if hasattr (self , 'creation_date' ) and getattr (self , 'creation_date' ) is not None :
0 commit comments