Skip to content

Commit 8fcd8d7

Browse files
Merge pull request #1134 from rodrabe/master
Change encrypt parameters for importing of images.
2 parents cfab07e + a00df24 commit 8fcd8d7

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

SoftLayer/CLI/image/import.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,14 @@
2525
"creating this key see https://console.bluemix.net/docs/"
2626
"services/cloud-object-storage/iam/users-serviceids.html"
2727
"#serviceidapikeys")
28-
@click.option('--root-key-id',
28+
@click.option('--root-key-crn',
2929
default=None,
30-
help="ID of the root key in Key Protect")
30+
help="CRN of the root key in your KMS instance")
3131
@click.option('--wrapped-dek',
3232
default=None,
3333
help="Wrapped Data Encryption Key provided by IBM KeyProtect. "
3434
"For more info see https://console.bluemix.net/docs/"
3535
"services/key-protect/wrap-keys.html#wrap-keys")
36-
@click.option('--kp-id',
37-
default=None,
38-
help="ID of the IBM Key Protect Instance")
3936
@click.option('--cloud-init',
4037
is_flag=True,
4138
help="Specifies if image is cloud-init")
@@ -46,8 +43,8 @@
4643
is_flag=True,
4744
help="Specifies if image is encrypted")
4845
@environment.pass_env
49-
def cli(env, name, note, os_code, uri, ibm_api_key, root_key_id, wrapped_dek,
50-
kp_id, cloud_init, byol, is_encrypted):
46+
def cli(env, name, note, os_code, uri, ibm_api_key, root_key_crn, wrapped_dek,
47+
cloud_init, byol, is_encrypted):
5148
"""Import an image.
5249
5350
The URI for an object storage object (.vhd/.iso file) of the format:
@@ -63,9 +60,8 @@ def cli(env, name, note, os_code, uri, ibm_api_key, root_key_id, wrapped_dek,
6360
os_code=os_code,
6461
uri=uri,
6562
ibm_api_key=ibm_api_key,
66-
root_key_id=root_key_id,
63+
root_key_crn=root_key_crn,
6764
wrapped_dek=wrapped_dek,
68-
kp_id=kp_id,
6965
cloud_init=cloud_init,
7066
byol=byol,
7167
is_encrypted=is_encrypted

SoftLayer/managers/image.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def edit(self, image_id, name=None, note=None, tag=None):
121121
return bool(name or note or tag)
122122

123123
def import_image_from_uri(self, name, uri, os_code=None, note=None,
124-
ibm_api_key=None, root_key_id=None,
125-
wrapped_dek=None, kp_id=None, cloud_init=False,
124+
ibm_api_key=None, root_key_crn=None,
125+
wrapped_dek=None, cloud_init=False,
126126
byol=False, is_encrypted=False):
127127
"""Import a new image from object storage.
128128
@@ -136,11 +136,14 @@ def import_image_from_uri(self, name, uri, os_code=None, note=None,
136136
:param string os_code: The reference code of the operating system
137137
:param string note: Note to add to the image
138138
:param string ibm_api_key: Ibm Api Key needed to communicate with ICOS
139-
and Key Protect
140-
:param string root_key_id: ID of the root key in Key Protect
139+
and your KMS
140+
:param string root_key_crn: CRN of the root key in your KMS. Go to your
141+
KMS (Key Protect or Hyper Protect) provider to get the CRN for your
142+
root key. An example CRN:
143+
crn:v1:bluemix:public:hs-crypto:us-south:acctID:serviceID:key:keyID'
144+
Used only when is_encrypted is True.
141145
:param string wrapped_dek: Wrapped Data Encryption Key provided by
142-
IBM KeyProtect
143-
:param string kp_id: ID of the IBM Key Protect Instance
146+
your KMS. Used only when is_encrypted is True.
144147
:param boolean cloud_init: Specifies if image is cloud-init
145148
:param boolean byol: Specifies if image is bring your own license
146149
:param boolean is_encrypted: Specifies if image is encrypted
@@ -152,9 +155,8 @@ def import_image_from_uri(self, name, uri, os_code=None, note=None,
152155
'operatingSystemReferenceCode': os_code,
153156
'uri': uri,
154157
'ibmApiKey': ibm_api_key,
155-
'rootKeyId': root_key_id,
158+
'crkCrn': root_key_crn,
156159
'wrappedDek': wrapped_dek,
157-
'keyProtectId': kp_id,
158160
'cloudInit': cloud_init,
159161
'byol': byol,
160162
'isEncrypted': is_encrypted

tests/managers/image_tests.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ def test_import_image_cos(self):
151151
uri='cos://some_uri',
152152
os_code='UBUNTU_LATEST',
153153
ibm_api_key='some_ibm_key',
154-
root_key_id='some_root_key_id',
154+
root_key_crn='some_root_key_crn',
155155
wrapped_dek='some_dek',
156-
kp_id='some_id',
157156
cloud_init=False,
158157
byol=False,
159158
is_encrypted=False
@@ -167,9 +166,8 @@ def test_import_image_cos(self):
167166
'operatingSystemReferenceCode': 'UBUNTU_LATEST',
168167
'uri': 'cos://some_uri',
169168
'ibmApiKey': 'some_ibm_key',
170-
'rootKeyId': 'some_root_key_id',
169+
'crkCrn': 'some_root_key_crn',
171170
'wrappedDek': 'some_dek',
172-
'keyProtectId': 'some_id',
173171
'cloudInit': False,
174172
'byol': False,
175173
'isEncrypted': False

0 commit comments

Comments
 (0)