Skip to content

Commit 809c00d

Browse files
committed
feat(install): add set gateway ssl
Signed-off-by: Chris Snow <[email protected]>
1 parent 8639028 commit 809c00d

File tree

2 files changed

+46
-26
lines changed

2 files changed

+46
-26
lines changed

hpecp/cli/install.py

+23-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class InstallProxy(object):
3737

3838
def __dir__(self):
3939
"""Return the CLI method names."""
40-
return ["examples", "get"]
40+
return ["examples", "get", "set_gateway_ssl"]
4141

4242
@base.intercept_exception
4343
def get(self, output="yaml", query=None):
@@ -62,7 +62,7 @@ def get(self, output="yaml", query=None):
6262
)
6363
sys.exit(1)
6464

65-
response = base.get_client().config.get()
65+
response = base.get_client().install.get()
6666

6767
if output == "yaml":
6868
print(
@@ -92,9 +92,27 @@ def examples(self):
9292
dedent(
9393
"""\
9494
95-
$ hpecp install get --query 'objects.[cpu_allocation_ratio]' --output json
96-
1
97-
9895
""" # noqa: E501
9996
)
10097
)
98+
99+
@base.intercept_exception
100+
def set_gateway_ssl(
101+
self, cert_content, cert_file_name, key_content, key_file_name
102+
):
103+
"""Set Gateway SSL.
104+
105+
Parameters
106+
----------
107+
cert_content : [type]
108+
[description]
109+
cert_file_name : [type]
110+
[description]
111+
key_content : [type]
112+
[description]
113+
key_file_name : [type]
114+
[description]
115+
"""
116+
base.get_client().install.set_gateway_ssl(
117+
cert_content, cert_file_name, key_content, key_file_name
118+
)

hpecp/install.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,27 @@ def get(self):
4444
)
4545
return response.json()
4646

47-
# def set_gateway_ssl(self, ):
48-
# """Set Gateway SSL."""
49-
# _data = {
50-
# "gateway_ssl_cert_info": {
51-
# "cert_file": {
52-
# "content": "-----BEGIN CERTIFICATE-----XXXX-----END CERTIFICATE-----\n",
53-
# "file_name": "cert.pem",
54-
# },
55-
# "key_file": {
56-
# "content": "-----BEGIN RSA PRIVATE KEY-----XXXX-----END RSA PRIVATE KEY-----\n",
57-
# "file_name": "key.pem",
58-
# },
59-
# }
60-
# }
47+
def set_gateway_ssl(
48+
self, cert_content, cert_file_name, key_content, key_file_name
49+
):
50+
"""Set Gateway SSL."""
51+
_data = {
52+
"gateway_ssl_cert_info": {
53+
"cert_file": {
54+
"content": cert_content,
55+
"file_name": cert_file_name,
56+
},
57+
"key_file": {
58+
"content": key_content,
59+
"file_name": key_file_name,
60+
},
61+
}
62+
}
6163

62-
# response = self.client._request(
63-
# url="/api/v1/install?install_reconfig",
64-
# http_method="put",
65-
# data=_data,
66-
# description="install/set_gateway_ssl",
67-
# )
68-
# return response.json()
64+
response = self.client._request(
65+
url="/api/v1/install?install_reconfig",
66+
http_method="put",
67+
data=_data,
68+
description="install/set_gateway_ssl",
69+
)
70+
return response.json()

0 commit comments

Comments
 (0)