Skip to content

Commit 857b6a6

Browse files
committed
fix public cert rotation policy
1 parent acdfbed commit 857b6a6

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

ibm_secrets_manager_sdk/secrets_manager_v2.py

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22853,8 +22853,10 @@ class PublicCertificatePrototype(SecretPrototype):
2285322853
:attr bool bundle_certs: (optional) This field indicates whether your issued
2285422854
certificate is bundled with intermediate certificates. Set to `false` for the
2285522855
certificate file to contain only the issued certificate.
22856-
:attr RotationPolicy rotation: (optional) This field indicates whether Secrets
22857-
Manager rotates your secrets automatically.
22856+
:attr PublicCertificateRotationPolicy rotation: (optional) This field indicates
22857+
whether Secrets Manager rotates your secrets automatically.
22858+
For public certificates, if `auto_rotate` is set to `true`, the service reorders
22859+
your certificate for 31 days, before it expires.
2285822860
:attr dict custom_metadata: (optional) The secret metadata that a user can
2285922861
customize.
2286022862
:attr dict version_custom_metadata: (optional) The secret version metadata that
@@ -22874,7 +22876,7 @@ def __init__(self,
2287422876
alt_names: List[str] = None,
2287522877
key_algorithm: str = None,
2287622878
bundle_certs: bool = None,
22877-
rotation: 'RotationPolicy' = None,
22879+
rotation: 'PublicCertificateRotationPolicy' = None,
2287822880
custom_metadata: dict = None,
2287922881
version_custom_metadata: dict = None) -> None:
2288022882
"""
@@ -22920,8 +22922,10 @@ def __init__(self,
2292022922
:param bool bundle_certs: (optional) This field indicates whether your
2292122923
issued certificate is bundled with intermediate certificates. Set to
2292222924
`false` for the certificate file to contain only the issued certificate.
22923-
:param RotationPolicy rotation: (optional) This field indicates whether
22924-
Secrets Manager rotates your secrets automatically.
22925+
:param PublicCertificateRotationPolicy rotation: (optional) This field
22926+
indicates whether Secrets Manager rotates your secrets automatically.
22927+
For public certificates, if `auto_rotate` is set to `true`, the service
22928+
reorders your certificate for 31 days, before it expires.
2292522929
:param dict custom_metadata: (optional) The secret metadata that a user can
2292622930
customize.
2292722931
:param dict version_custom_metadata: (optional) The secret version metadata
@@ -22980,7 +22984,7 @@ def from_dict(cls, _dict: Dict) -> 'PublicCertificatePrototype':
2298022984
if 'bundle_certs' in _dict:
2298122985
args['bundle_certs'] = _dict.get('bundle_certs')
2298222986
if 'rotation' in _dict:
22983-
args['rotation'] = _dict.get('rotation')
22987+
args['rotation'] = PublicCertificateRotationPolicy.from_dict(_dict.get('rotation'))
2298422988
if 'custom_metadata' in _dict:
2298522989
args['custom_metadata'] = _dict.get('custom_metadata')
2298622990
if 'version_custom_metadata' in _dict:
@@ -23070,8 +23074,6 @@ class PublicCertificateRotationPolicy(RotationPolicy):
2307023074
your secret automatically.
2307123075
The default is `false`. If `auto_rotate` is set to `true` the service rotates
2307223076
your secret based on the defined interval.
23073-
:attr int interval: (optional) The length of the secret rotation time interval.
23074-
:attr str unit: (optional) The units for the secret rotation time interval.
2307523077
:attr bool rotate_keys: (optional) This field indicates whether Secrets Manager
2307623078
rotates the private key for your public certificate automatically.
2307723079
The default is `false`. If it is set to `true`, the service generates and stores
@@ -23081,8 +23083,6 @@ class PublicCertificateRotationPolicy(RotationPolicy):
2308123083
def __init__(self,
2308223084
auto_rotate: bool,
2308323085
*,
23084-
interval: int = None,
23085-
unit: str = None,
2308623086
rotate_keys: bool = None) -> None:
2308723087
"""
2308823088
Initialize a PublicCertificateRotationPolicy object.
@@ -23091,19 +23091,13 @@ def __init__(self,
2309123091
rotates your secret automatically.
2309223092
The default is `false`. If `auto_rotate` is set to `true` the service
2309323093
rotates your secret based on the defined interval.
23094-
:param int interval: (optional) The length of the secret rotation time
23095-
interval.
23096-
:param str unit: (optional) The units for the secret rotation time
23097-
interval.
2309823094
:param bool rotate_keys: (optional) This field indicates whether Secrets
2309923095
Manager rotates the private key for your public certificate automatically.
2310023096
The default is `false`. If it is set to `true`, the service generates and
2310123097
stores a new private key for your rotated certificate.
2310223098
"""
2310323099
# pylint: disable=super-init-not-called
2310423100
self.auto_rotate = auto_rotate
23105-
self.interval = interval
23106-
self.unit = unit
2310723101
self.rotate_keys = rotate_keys
2310823102

2310923103
@classmethod
@@ -23114,10 +23108,6 @@ def from_dict(cls, _dict: Dict) -> 'PublicCertificateRotationPolicy':
2311423108
args['auto_rotate'] = _dict.get('auto_rotate')
2311523109
else:
2311623110
raise ValueError('Required property \'auto_rotate\' not present in PublicCertificateRotationPolicy JSON')
23117-
if 'interval' in _dict:
23118-
args['interval'] = _dict.get('interval')
23119-
if 'unit' in _dict:
23120-
args['unit'] = _dict.get('unit')
2312123111
if 'rotate_keys' in _dict:
2312223112
args['rotate_keys'] = _dict.get('rotate_keys')
2312323113
return cls(**args)
@@ -23132,10 +23122,6 @@ def to_dict(self) -> Dict:
2313223122
_dict = {}
2313323123
if hasattr(self, 'auto_rotate') and self.auto_rotate is not None:
2313423124
_dict['auto_rotate'] = self.auto_rotate
23135-
if hasattr(self, 'interval') and self.interval is not None:
23136-
_dict['interval'] = self.interval
23137-
if hasattr(self, 'unit') and self.unit is not None:
23138-
_dict['unit'] = self.unit
2313923125
if hasattr(self, 'rotate_keys') and self.rotate_keys is not None:
2314023126
_dict['rotate_keys'] = self.rotate_keys
2314123127
return _dict
@@ -23158,14 +23144,6 @@ def __ne__(self, other: 'PublicCertificateRotationPolicy') -> bool:
2315823144
"""Return `true` when self and other are not equal, false otherwise."""
2315923145
return not self == other
2316023146

23161-
class UnitEnum(str, Enum):
23162-
"""
23163-
The units for the secret rotation time interval.
23164-
"""
23165-
DAY = 'day'
23166-
MONTH = 'month'
23167-
23168-
2316923147
class PublicCertificateVersion(SecretVersion):
2317023148
"""
2317123149
Versions of your public certificate.

test/unit/test_secrets_manager_v2.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8333,10 +8333,9 @@ def test_public_certificate_prototype_serialization(self):
83338333

83348334
# Construct dict forms of any model objects needed in order to build this model.
83358335

8336-
rotation_policy_model = {} # CommonRotationPolicy
8337-
rotation_policy_model['auto_rotate'] = True
8338-
rotation_policy_model['interval'] = 1
8339-
rotation_policy_model['unit'] = 'day'
8336+
public_certificate_rotation_policy_model = {} # PublicCertificateRotationPolicy
8337+
public_certificate_rotation_policy_model['auto_rotate'] = True
8338+
public_certificate_rotation_policy_model['rotate_keys'] = True
83408339

83418340
# Construct a json representation of a PublicCertificatePrototype model
83428341
public_certificate_prototype_model_json = {}
@@ -8351,7 +8350,7 @@ def test_public_certificate_prototype_serialization(self):
83518350
public_certificate_prototype_model_json['ca'] = 'my-example-engine-config'
83528351
public_certificate_prototype_model_json['dns'] = 'my-example-engine-config'
83538352
public_certificate_prototype_model_json['bundle_certs'] = True
8354-
public_certificate_prototype_model_json['rotation'] = rotation_policy_model
8353+
public_certificate_prototype_model_json['rotation'] = public_certificate_rotation_policy_model
83558354
public_certificate_prototype_model_json['custom_metadata'] = {'foo': 'bar'}
83568355
public_certificate_prototype_model_json['version_custom_metadata'] = {'foo': 'bar'}
83578356

@@ -8383,8 +8382,6 @@ def test_public_certificate_rotation_policy_serialization(self):
83838382
# Construct a json representation of a PublicCertificateRotationPolicy model
83848383
public_certificate_rotation_policy_model_json = {}
83858384
public_certificate_rotation_policy_model_json['auto_rotate'] = True
8386-
public_certificate_rotation_policy_model_json['interval'] = 1
8387-
public_certificate_rotation_policy_model_json['unit'] = 'day'
83888385
public_certificate_rotation_policy_model_json['rotate_keys'] = True
83898386

83908387
# Construct a model instance of PublicCertificateRotationPolicy by calling from_dict on the json representation

0 commit comments

Comments
 (0)