@@ -171,114 +171,136 @@ func (enum *NamespaceProtocol) UnmarshalJSON(data []byte) error {
171171 return nil
172172}
173173
174+ // Credential: credential
174175type Credential struct {
176+ // ID: credential ID
175177 ID string `json:"id"`
176-
178+ // Name: credential name
177179 Name string `json:"name"`
178-
180+ // NamespaceID: namespace containing the Credential
179181 NamespaceID string `json:"namespace_id"`
180- // Protocol:
182+ // Protocol: protocol associated to the Credential
181183 //
182184 // Default value: unknown
183185 Protocol NamespaceProtocol `json:"protocol"`
184-
186+ // NatsCredentials: credentials file used to connect to the NATS service
185187 // Precisely one of AmqpCredentials, NatsCredentials, SqsSnsCredentials must be set.
186188 NatsCredentials * CredentialNATSCredsFile `json:"nats_credentials,omitempty"`
187-
189+ // SqsSnsCredentials: credential used to connect to the SQS/SNS service
188190 // Precisely one of AmqpCredentials, NatsCredentials, SqsSnsCredentials must be set.
189191 SqsSnsCredentials * CredentialSQSSNSCreds `json:"sqs_sns_credentials,omitempty"`
190-
192+ // AmqpCredentials: credential used to connect to the AMQP service
191193 // Precisely one of AmqpCredentials, NatsCredentials, SqsSnsCredentials must be set.
192194 AmqpCredentials * CredentialAMQPCreds `json:"amqp_credentials,omitempty"`
193195}
194196
197+ // CredentialAMQPCreds: credential.amqp creds
195198type CredentialAMQPCreds struct {
199+ // Username: username used to connect to the AMQP service
196200 Username string `json:"username"`
197-
201+ // Password: password used to connect to the AMQP service
198202 Password * string `json:"password"`
199-
203+ // Permissions: list of permissions associated to this Credential
200204 Permissions * Permissions `json:"permissions"`
201205}
202206
207+ // CredentialNATSCredsFile: credential.nats creds file
203208type CredentialNATSCredsFile struct {
209+ // Content: raw content of the NATS credentials file
204210 Content string `json:"content"`
205211}
206212
213+ // CredentialSQSSNSCreds: credential.sqssns creds
207214type CredentialSQSSNSCreds struct {
215+ // AccessKey: ID of the key
208216 AccessKey string `json:"access_key"`
209-
217+ // SecretKey: secret value of the key
210218 SecretKey * string `json:"secret_key"`
211-
219+ // Permissions: list of permissions associated to this Credential
212220 Permissions * Permissions `json:"permissions"`
213221}
214222
223+ // CredentialSummary: credential summary
215224type CredentialSummary struct {
225+ // ID: credential ID
216226 ID string `json:"id"`
217-
227+ // Name: credential name
218228 Name string `json:"name"`
219-
229+ // NamespaceID: namespace containing the Credential
220230 NamespaceID string `json:"namespace_id"`
221- // Protocol:
231+ // Protocol: protocol associated to the Credential
222232 //
223233 // Default value: unknown
224234 Protocol NamespaceProtocol `json:"protocol"`
225-
235+ // SqsSnsCredentials: credential used to connect to the SQS/SNS service
226236 // Precisely one of AmqpCredentials, SqsSnsCredentials must be set.
227237 SqsSnsCredentials * CredentialSummarySQSSNSCreds `json:"sqs_sns_credentials,omitempty"`
228-
238+ // AmqpCredentials: credential used to connect to the AMQP service
229239 // Precisely one of AmqpCredentials, SqsSnsCredentials must be set.
230240 AmqpCredentials * CredentialSummaryAMQPCreds `json:"amqp_credentials,omitempty"`
231241}
232242
243+ // CredentialSummaryAMQPCreds: credential summary.amqp creds
233244type CredentialSummaryAMQPCreds struct {
245+ // Username: username used to connect to the AMQP service
234246 Username string `json:"username"`
235-
247+ // Permissions: list of permissions associated to this Credential
236248 Permissions * Permissions `json:"permissions"`
237249}
238250
251+ // CredentialSummarySQSSNSCreds: credential summary.sqssns creds
239252type CredentialSummarySQSSNSCreds struct {
253+ // AccessKey: ID of the key
240254 AccessKey string `json:"access_key"`
241-
255+ // Permissions: list of permissions associated to this Credential
242256 Permissions * Permissions `json:"permissions"`
243257}
244258
259+ // ListCredentialsResponse: list credentials response
245260type ListCredentialsResponse struct {
261+ // TotalCount: total number of existing Credentials
246262 TotalCount uint32 `json:"total_count"`
247-
263+ // Credentials: a page of Credentials
248264 Credentials []* CredentialSummary `json:"credentials"`
249265}
250266
267+ // ListNamespacesResponse: list namespaces response
251268type ListNamespacesResponse struct {
269+ // TotalCount: total number of existing Namespaces
252270 TotalCount uint32 `json:"total_count"`
253-
271+ // Namespaces: a page of Namespaces
254272 Namespaces []* Namespace `json:"namespaces"`
255273}
256274
275+ // Namespace: namespace
257276type Namespace struct {
277+ // ID: namespace ID
258278 ID string `json:"id"`
259-
260- ProjectID string `json:"project_id"`
261-
279+ // Name: namespace name
262280 Name string `json:"name"`
263-
281+ // Endpoint: endpoint of the service matching the Namespace protocol
264282 Endpoint string `json:"endpoint"`
265- // Protocol:
283+ // Protocol: namespace protocol
266284 //
267285 // Default value: unknown
268286 Protocol NamespaceProtocol `json:"protocol"`
269-
287+ // ProjectID: project containing the Namespace
288+ ProjectID string `json:"project_id"`
289+ // Region: region where the Namespace is deployed
290+ Region scw.Region `json:"region"`
291+ // CreatedAt: namespace creation date
270292 CreatedAt * time.Time `json:"created_at"`
271-
293+ // UpdatedAt: namespace last modification date
272294 UpdatedAt * time.Time `json:"updated_at"`
273-
274- Region scw.Region `json:"region"`
275295}
276296
297+ // Permissions: permissions
277298type Permissions struct {
299+ // CanPublish: defines if user can publish messages to the service
278300 CanPublish * bool `json:"can_publish"`
279-
301+ // CanReceive: defines if user can receive messages from the service
280302 CanReceive * bool `json:"can_receive"`
281-
303+ // CanManage: defines if user can manage the associated resource(s)
282304 CanManage * bool `json:"can_manage"`
283305}
284306
@@ -289,18 +311,18 @@ type ListNamespacesRequest struct {
289311 //
290312 // Region to target. If none is passed will use default region from the config
291313 Region scw.Region `json:"-"`
292-
314+ // OrganizationID: will list only the Namespaces owned by the specified organization
315+ OrganizationID * string `json:"-"`
316+ // ProjectID: will list only the Namespaces contained into the specified project
293317 ProjectID * string `json:"-"`
294-
318+ // Page: indicate the page number of results to be returned
295319 Page * int32 `json:"-"`
296-
320+ // PageSize: maximum number of results returned by page
297321 PageSize * uint32 `json:"-"`
298- // OrderBy:
322+ // OrderBy: field used for sorting results
299323 //
300324 // Default value: created_at_asc
301325 OrderBy ListNamespacesRequestOrderBy `json:"-"`
302-
303- OrganizationID * string `json:"-"`
304326}
305327
306328// ListNamespaces: list namespaces
@@ -318,11 +340,11 @@ func (s *API) ListNamespaces(req *ListNamespacesRequest, opts ...scw.RequestOpti
318340 }
319341
320342 query := url.Values {}
343+ parameter .AddToQuery (query , "organization_id" , req .OrganizationID )
321344 parameter .AddToQuery (query , "project_id" , req .ProjectID )
322345 parameter .AddToQuery (query , "page" , req .Page )
323346 parameter .AddToQuery (query , "page_size" , req .PageSize )
324347 parameter .AddToQuery (query , "order_by" , req .OrderBy )
325- parameter .AddToQuery (query , "organization_id" , req .OrganizationID )
326348
327349 if fmt .Sprint (req .Region ) == "" {
328350 return nil , errors .New ("field Region cannot be empty in request" )
@@ -349,14 +371,14 @@ type CreateNamespaceRequest struct {
349371 //
350372 // Region to target. If none is passed will use default region from the config
351373 Region scw.Region `json:"-"`
352-
374+ // Name: namespace name
353375 Name string `json:"name"`
354-
355- ProjectID string `json:"project_id"`
356- // Protocol:
376+ // Protocol: namespace protocol
357377 //
358378 // Default value: unknown
359379 Protocol NamespaceProtocol `json:"protocol"`
380+ // ProjectID: project containing the Namespace
381+ ProjectID string `json:"project_id"`
360382}
361383
362384// CreateNamespace: create a namespace
@@ -373,6 +395,10 @@ func (s *API) CreateNamespace(req *CreateNamespaceRequest, opts ...scw.RequestOp
373395 req .Region = defaultRegion
374396 }
375397
398+ if req .Name == "" {
399+ req .Name = namegenerator .GetRandomName ("mnq" )
400+ }
401+
376402 if fmt .Sprint (req .Region ) == "" {
377403 return nil , errors .New ("field Region cannot be empty in request" )
378404 }
@@ -402,9 +428,9 @@ type UpdateNamespaceRequest struct {
402428 //
403429 // Region to target. If none is passed will use default region from the config
404430 Region scw.Region `json:"-"`
405-
431+ // NamespaceID: ID of the Namespace to update
406432 NamespaceID string `json:"namespace_id"`
407-
433+ // Name: namespace name
408434 Name * string `json:"name"`
409435}
410436
@@ -446,7 +472,7 @@ type GetNamespaceRequest struct {
446472 //
447473 // Region to target. If none is passed will use default region from the config
448474 Region scw.Region `json:"-"`
449-
475+ // NamespaceID: ID of the Namespace to get
450476 NamespaceID string `json:"-"`
451477}
452478
@@ -487,7 +513,7 @@ type DeleteNamespaceRequest struct {
487513 //
488514 // Region to target. If none is passed will use default region from the config
489515 Region scw.Region `json:"-"`
490-
516+ // NamespaceID: ID of the Namespace to delete
491517 NamespaceID string `json:"-"`
492518}
493519
@@ -526,11 +552,11 @@ type CreateCredentialRequest struct {
526552 //
527553 // Region to target. If none is passed will use default region from the config
528554 Region scw.Region `json:"-"`
529-
530- Name string `json:"name"`
531-
555+ // NamespaceID: namespace containing the Credential
532556 NamespaceID string `json:"namespace_id"`
533-
557+ // Name: credential name
558+ Name string `json:"name"`
559+ // Permissions: list of permissions associated to this Credential
534560 // Precisely one of Permissions must be set.
535561 Permissions * Permissions `json:"permissions,omitempty"`
536562}
@@ -546,6 +572,10 @@ func (s *API) CreateCredential(req *CreateCredentialRequest, opts ...scw.Request
546572 req .Region = defaultRegion
547573 }
548574
575+ if req .Name == "" {
576+ req .Name = namegenerator .GetRandomName ("mnq" )
577+ }
578+
549579 if fmt .Sprint (req .Region ) == "" {
550580 return nil , errors .New ("field Region cannot be empty in request" )
551581 }
@@ -575,7 +605,7 @@ type DeleteCredentialRequest struct {
575605 //
576606 // Region to target. If none is passed will use default region from the config
577607 Region scw.Region `json:"-"`
578-
608+ // CredentialID: ID of the Credential to delete
579609 CredentialID string `json:"-"`
580610}
581611
@@ -614,13 +644,13 @@ type ListCredentialsRequest struct {
614644 //
615645 // Region to target. If none is passed will use default region from the config
616646 Region scw.Region `json:"-"`
617-
647+ // NamespaceID: namespace containing the Credential
618648 NamespaceID * string `json:"-"`
619-
649+ // Page: indicate the page number of results to be returned
620650 Page * int32 `json:"-"`
621-
651+ // PageSize: maximum number of results returned by page
622652 PageSize * uint32 `json:"-"`
623- // OrderBy:
653+ // OrderBy: field used for sorting results
624654 //
625655 // Default value: id_asc
626656 OrderBy ListCredentialsRequestOrderBy `json:"-"`
@@ -671,11 +701,11 @@ type UpdateCredentialRequest struct {
671701 //
672702 // Region to target. If none is passed will use default region from the config
673703 Region scw.Region `json:"-"`
674-
704+ // CredentialID: ID of the Credential to update
675705 CredentialID string `json:"-"`
676-
706+ // Name: credential name
677707 Name * string `json:"name"`
678-
708+ // Permissions: list of permissions associated to this Credential
679709 // Precisely one of Permissions must be set.
680710 Permissions * Permissions `json:"permissions,omitempty"`
681711}
@@ -724,7 +754,7 @@ type GetCredentialRequest struct {
724754 //
725755 // Region to target. If none is passed will use default region from the config
726756 Region scw.Region `json:"-"`
727-
757+ // CredentialID: ID of the Credential to get
728758 CredentialID string `json:"-"`
729759}
730760
0 commit comments