Skip to content

Commit b5bfc28

Browse files
authored
Merge pull request #261 from hpe-container-platform-community/add_parameters_to_tenant_create
feat(tenant): richer create method
2 parents afa2778 + 940e899 commit b5bfc28

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

hpecp/cli/tenant.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def create(
5959
description=None,
6060
tenant_type=None,
6161
k8s_cluster_id=None,
62+
is_namespace_owner=None,
63+
map_services_to_gateway=None,
64+
specified_namespace_name=None,
65+
adopt_existing_namespace=None,
6266
):
6367
"""Create a tenant.
6468
@@ -72,12 +76,24 @@ def create(
7276
[description], by default None
7377
k8s_cluster_id : [type], optional
7478
[description], by default None
79+
is_namespace_owner : [type], optional
80+
[description], by default None
81+
map_services_to_gateway : [type], optional
82+
[description], by default None
83+
specified_namespace_name : [type], optional
84+
[description], by default None
85+
adopt_existing_namespace : [type], optional
86+
[description], by default None
7587
"""
7688
tenant_id = base.get_client().tenant.create(
7789
name=name,
7890
description=description,
7991
tenant_type=tenant_type,
8092
k8s_cluster_id=k8s_cluster_id,
93+
is_namespace_owner=is_namespace_owner,
94+
map_services_to_gateway=map_services_to_gateway,
95+
specified_namespace_name=specified_namespace_name,
96+
adopt_existing_namespace=adopt_existing_namespace,
8197
)
8298
print(tenant_id)
8399

hpecp/tenant.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ def create(
138138
description=None,
139139
tenant_type=None,
140140
k8s_cluster_id=None,
141+
is_namespace_owner=None,
142+
map_services_to_gateway=None,
143+
specified_namespace_name=None,
144+
adopt_existing_namespace=None,
141145
):
142146

143147
assert (
@@ -159,6 +163,23 @@ def create(
159163
}
160164
if description is not None:
161165
data["label"]["description"] = description
166+
if is_namespace_owner is not None:
167+
data["tenant_type_info"]["is_namespace_owner"] = is_namespace_owner
168+
if map_services_to_gateway is not None:
169+
data["map_services_to_gateway"] = map_services_to_gateway
170+
data["tenant_type_info"][
171+
"map_services_to_gateway"
172+
] = map_services_to_gateway
173+
if specified_namespace_name is not None:
174+
data["specified_namespace_name"] = specified_namespace_name
175+
data["tenant_type_info"][
176+
"specified_namespace_name"
177+
] = specified_namespace_name
178+
if adopt_existing_namespace is not None:
179+
data["adopt_existing_namespace"] = adopt_existing_namespace
180+
data["tenant_type_info"][
181+
"adopt_existing_namespace"
182+
] = adopt_existing_namespace
162183

163184
response = self.client._request(
164185
url="/api/v1/tenant",

0 commit comments

Comments
 (0)