@@ -88,6 +88,9 @@ def _set_cluster_uuid(self, value):
88
88
pem = wtypes .StringType ()
89
89
""""The Signed Certificate"""
90
90
91
+ ca_cert_type = wtypes .StringType ()
92
+ """"The CA Certificate type the CSR will be signed by"""
93
+
91
94
def __init__ (self , ** kwargs ):
92
95
super (Certificate , self ).__init__ ()
93
96
@@ -113,7 +116,7 @@ def get_cluster(self):
113
116
def _convert_with_links (certificate , url , expand = True ):
114
117
if not expand :
115
118
certificate .unset_fields_except (['bay_uuid' , 'cluster_uuid' ,
116
- 'csr' , 'pem' ])
119
+ 'csr' , 'pem' , 'ca_cert_type' ])
117
120
118
121
certificate .links = [link .Link .make_link ('self' , url ,
119
122
'certificates' ,
@@ -135,7 +138,8 @@ def sample(cls, expand=True):
135
138
sample = cls (bay_uuid = '7ae81bb3-dec3-4289-8d6c-da80bd8001ae' ,
136
139
cluster_uuid = '7ae81bb3-dec3-4289-8d6c-da80bd8001ae' ,
137
140
created_at = timeutils .utcnow (),
138
- csr = 'AAA....AAA' )
141
+ csr = 'AAA....AAA' ,
142
+ ca_cert_type = 'kubernetes' )
139
143
return cls ._convert_with_links (sample , 'http://localhost:9511' , expand )
140
144
141
145
@@ -149,8 +153,8 @@ def __init__(self):
149
153
'detail' : ['GET' ],
150
154
}
151
155
152
- @expose .expose (Certificate , types .uuid_or_name )
153
- def get_one (self , cluster_ident ):
156
+ @expose .expose (Certificate , types .uuid_or_name , wtypes . text )
157
+ def get_one (self , cluster_ident , ca_cert_type = None ):
154
158
"""Retrieve CA information about the given cluster.
155
159
156
160
:param cluster_ident: UUID of a cluster or
@@ -160,7 +164,8 @@ def get_one(self, cluster_ident):
160
164
cluster = api_utils .get_resource ('Cluster' , cluster_ident )
161
165
policy .enforce (context , 'certificate:get' , cluster .as_dict (),
162
166
action = 'certificate:get' )
163
- certificate = pecan .request .rpcapi .get_ca_certificate (cluster )
167
+ certificate = pecan .request .rpcapi .get_ca_certificate (cluster ,
168
+ ca_cert_type )
164
169
return Certificate .convert_with_links (certificate )
165
170
166
171
@expose .expose (Certificate , body = Certificate , status_code = 201 )
0 commit comments