Skip to content

Commit 6b66c4c

Browse files
authored
feat: [PL-63595]: Support for setting TTL on Delegate Token in Terraform (#672)
1 parent 2213993 commit 6b66c4c

8 files changed

+257
-49
lines changed

harness/nextgen/api_delegate_token_resource.go

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ DelegateTokenResourceApiService Creates Delegate Token.
3434
* @param optional nil or *DelegateTokenResourceApiCreateDelegateTokenOpts - Optional Parameters:
3535
* @param "OrgIdentifier" (optional.String) - Organization Identifier for the Entity.
3636
* @param "ProjectIdentifier" (optional.String) - Project Identifier for the Entity.
37+
* @param "RevokeAfter" (optional.Int64) - Epoch time in milliseconds after which the token will be marked as revoked. There can be a delay of upto one hour from the epoch value provided and actual revoking of the token.
3738
@return RestResponseDelegateTokenDetails
3839
*/
3940

4041
type DelegateTokenResourceApiCreateDelegateTokenOpts struct {
4142
OrgIdentifier optional.String
4243
ProjectIdentifier optional.String
44+
RevokeAfter optional.Int64
4345
}
4446

4547
func (a *DelegateTokenResourceApiService) CreateDelegateToken(ctx context.Context, accountIdentifier string, tokenName string, localVarOptionals *DelegateTokenResourceApiCreateDelegateTokenOpts) (RestResponseDelegateTokenDetails, *http.Response, error) {
@@ -66,6 +68,9 @@ func (a *DelegateTokenResourceApiService) CreateDelegateToken(ctx context.Contex
6668
localVarQueryParams.Add("projectIdentifier", parameterToString(localVarOptionals.ProjectIdentifier.Value(), ""))
6769
}
6870
localVarQueryParams.Add("tokenName", parameterToString(tokenName, ""))
71+
if localVarOptionals != nil && localVarOptionals.RevokeAfter.IsSet() {
72+
localVarQueryParams.Add("revokeAfter", parameterToString(localVarOptionals.RevokeAfter.Value(), ""))
73+
}
6974
// to determine the Content-Type header
7075
localVarHttpContentTypes := []string{}
7176

@@ -162,47 +167,52 @@ func (a *DelegateTokenResourceApiService) CreateDelegateToken(ctx context.Contex
162167
}
163168

164169
/*
165-
DelegateTokenResourceApiService Lists delegate groups that are using the specified delegate token.
170+
DelegateTokenResourceApiService Retrieves Delegate Tokens by Account, Organization, Project and status.
166171
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
167172
* @param accountIdentifier Account Identifier for the Entity.
168-
* @param optional nil or *DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts - Optional Parameters:
173+
* @param optional nil or *DelegateTokenResourceApiGetCgDelegateTokensOpts - Optional Parameters:
174+
* @param "Name" (optional.String) - Name of Delegate Token (ACTIVE or REVOKED).
169175
* @param "OrgIdentifier" (optional.String) - Organization Identifier for the Entity.
170176
* @param "ProjectIdentifier" (optional.String) - Project Identifier for the Entity.
171-
* @param "DelegateTokenName" (optional.String) - Delegate Token name
172-
@return RestResponseDelegateGroupListing
177+
* @param "Status" (optional.String) - Status of Delegate Token (ACTIVE or REVOKED). If left empty both active and revoked tokens will be retrieved
178+
@return RestResponseListDelegateTokenDetails
173179
*/
174180

175-
type DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts struct {
181+
type DelegateTokenResourceApiGetCgDelegateTokensOpts struct {
182+
Name optional.String
176183
OrgIdentifier optional.String
177184
ProjectIdentifier optional.String
178-
DelegateTokenName optional.String
185+
Status optional.String
179186
}
180187

181-
func (a *DelegateTokenResourceApiService) GetDelegateGroupsUsingToken(ctx context.Context, accountIdentifier string, localVarOptionals *DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts) (RestResponseDelegateGroupListing, *http.Response, error) {
188+
func (a *DelegateTokenResourceApiService) GetCgDelegateTokens(ctx context.Context, accountIdentifier string, localVarOptionals *DelegateTokenResourceApiGetCgDelegateTokensOpts) (RestResponseListDelegateTokenDetails, *http.Response, error) {
182189
var (
183190
localVarHttpMethod = strings.ToUpper("Get")
184191
localVarPostBody interface{}
185192
localVarFileName string
186193
localVarFileBytes []byte
187-
localVarReturnValue RestResponseDelegateGroupListing
194+
localVarReturnValue RestResponseListDelegateTokenDetails
188195
)
189196

190197
// create path and map variables
191-
localVarPath := a.client.cfg.BasePath + "/ng/api/delegate-token-ng/delegate-groups"
198+
localVarPath := a.client.cfg.BasePath + "/ng/api/delegate-token-ng"
192199

193200
localVarHeaderParams := make(map[string]string)
194201
localVarQueryParams := url.Values{}
195202
localVarFormParams := url.Values{}
196203

204+
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
205+
localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
206+
}
197207
localVarQueryParams.Add("accountIdentifier", parameterToString(accountIdentifier, ""))
198208
if localVarOptionals != nil && localVarOptionals.OrgIdentifier.IsSet() {
199209
localVarQueryParams.Add("orgIdentifier", parameterToString(localVarOptionals.OrgIdentifier.Value(), ""))
200210
}
201211
if localVarOptionals != nil && localVarOptionals.ProjectIdentifier.IsSet() {
202212
localVarQueryParams.Add("projectIdentifier", parameterToString(localVarOptionals.ProjectIdentifier.Value(), ""))
203213
}
204-
if localVarOptionals != nil && localVarOptionals.DelegateTokenName.IsSet() {
205-
localVarQueryParams.Add("delegateTokenName", parameterToString(localVarOptionals.DelegateTokenName.Value(), ""))
214+
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
215+
localVarQueryParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
206216
}
207217
// to determine the Content-Type header
208218
localVarHttpContentTypes := []string{}
@@ -284,7 +294,7 @@ func (a *DelegateTokenResourceApiService) GetDelegateGroupsUsingToken(ctx contex
284294
return localVarReturnValue, localVarHttpResponse, newErr
285295
}
286296
if localVarHttpResponse.StatusCode == 0 {
287-
var v RestResponseDelegateGroupListing
297+
var v RestResponseListDelegateTokenDetails
288298
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
289299
if err != nil {
290300
newErr.error = err.Error()
@@ -300,35 +310,33 @@ func (a *DelegateTokenResourceApiService) GetDelegateGroupsUsingToken(ctx contex
300310
}
301311

302312
/*
303-
DelegateTokenResourceApiService Retrieves Delegate Tokens by Account, Organization, Project and status.
313+
DelegateTokenResourceApiService Lists delegate groups that are using the specified delegate token.
304314
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
305315
* @param accountIdentifier Account Identifier for the Entity.
306-
* @param optional nil or *DelegateTokenResourceApiGetDelegateTokensOpts - Optional Parameters:
316+
* @param optional nil or *DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts - Optional Parameters:
307317
* @param "OrgIdentifier" (optional.String) - Organization Identifier for the Entity.
308318
* @param "ProjectIdentifier" (optional.String) - Project Identifier for the Entity.
309-
* @param "Status" (optional.String) - Status of Delegate Token (ACTIVE or REVOKED). If left empty both active and revoked tokens will be retrieved
310-
* @param "Name" (optional.String) - Name of the delegate token to be retrieved.
311-
@return RestResponseListDelegateTokenDetails
319+
* @param "DelegateTokenName" (optional.String) - Delegate Token name
320+
@return RestResponseDelegateGroupListing
312321
*/
313322

314-
type DelegateTokenResourceApiGetDelegateTokensOpts struct {
323+
type DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts struct {
315324
OrgIdentifier optional.String
316325
ProjectIdentifier optional.String
317-
Status optional.String
318-
Name optional.String
326+
DelegateTokenName optional.String
319327
}
320328

321-
func (a *DelegateTokenResourceApiService) GetDelegateTokens(ctx context.Context, accountIdentifier string, localVarOptionals *DelegateTokenResourceApiGetDelegateTokensOpts) (RestResponseListDelegateTokenDetails, *http.Response, error) {
329+
func (a *DelegateTokenResourceApiService) GetDelegateGroupsUsingToken(ctx context.Context, accountIdentifier string, localVarOptionals *DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts) (RestResponseDelegateGroupListing, *http.Response, error) {
322330
var (
323331
localVarHttpMethod = strings.ToUpper("Get")
324332
localVarPostBody interface{}
325333
localVarFileName string
326334
localVarFileBytes []byte
327-
localVarReturnValue RestResponseListDelegateTokenDetails
335+
localVarReturnValue RestResponseDelegateGroupListing
328336
)
329337

330338
// create path and map variables
331-
localVarPath := a.client.cfg.BasePath + "/ng/api/delegate-token-ng"
339+
localVarPath := a.client.cfg.BasePath + "/ng/api/delegate-token-ng/delegate-groups"
332340

333341
localVarHeaderParams := make(map[string]string)
334342
localVarQueryParams := url.Values{}
@@ -341,11 +349,8 @@ func (a *DelegateTokenResourceApiService) GetDelegateTokens(ctx context.Context,
341349
if localVarOptionals != nil && localVarOptionals.ProjectIdentifier.IsSet() {
342350
localVarQueryParams.Add("projectIdentifier", parameterToString(localVarOptionals.ProjectIdentifier.Value(), ""))
343351
}
344-
if localVarOptionals != nil && localVarOptionals.Status.IsSet() {
345-
localVarQueryParams.Add("status", parameterToString(localVarOptionals.Status.Value(), ""))
346-
}
347-
if localVarOptionals != nil && localVarOptionals.Name.IsSet() {
348-
localVarQueryParams.Add("name", parameterToString(localVarOptionals.Name.Value(), ""))
352+
if localVarOptionals != nil && localVarOptionals.DelegateTokenName.IsSet() {
353+
localVarQueryParams.Add("delegateTokenName", parameterToString(localVarOptionals.DelegateTokenName.Value(), ""))
349354
}
350355
// to determine the Content-Type header
351356
localVarHttpContentTypes := []string{}
@@ -427,7 +432,7 @@ func (a *DelegateTokenResourceApiService) GetDelegateTokens(ctx context.Context,
427432
return localVarReturnValue, localVarHttpResponse, newErr
428433
}
429434
if localVarHttpResponse.StatusCode == 0 {
430-
var v RestResponseListDelegateTokenDetails
435+
var v RestResponseDelegateGroupListing
431436
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
432437
if err != nil {
433438
newErr.error = err.Error()
@@ -447,18 +452,18 @@ DelegateTokenResourceApiService Revokes Delegate Token.
447452
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
448453
* @param accountIdentifier Account Identifier for the Entity.
449454
* @param tokenName Delegate Token name
450-
* @param optional nil or *DelegateTokenResourceApiRevokeDelegateTokenOpts - Optional Parameters:
455+
* @param optional nil or *DelegateTokenResourceApiRevokeCgDelegateTokenOpts - Optional Parameters:
451456
* @param "OrgIdentifier" (optional.String) - Organization Identifier for the Entity.
452457
* @param "ProjectIdentifier" (optional.String) - Project Identifier for the Entity.
453458
@return RestResponseDelegateTokenDetails
454459
*/
455460

456-
type DelegateTokenResourceApiRevokeDelegateTokenOpts struct {
461+
type DelegateTokenResourceApiRevokeCgDelegateTokenOpts struct {
457462
OrgIdentifier optional.String
458463
ProjectIdentifier optional.String
459464
}
460465

461-
func (a *DelegateTokenResourceApiService) RevokeDelegateToken(ctx context.Context, accountIdentifier string, tokenName string, localVarOptionals *DelegateTokenResourceApiRevokeDelegateTokenOpts) (RestResponseDelegateTokenDetails, *http.Response, error) {
466+
func (a *DelegateTokenResourceApiService) RevokeCgDelegateToken(ctx context.Context, accountIdentifier string, tokenName string, localVarOptionals *DelegateTokenResourceApiRevokeCgDelegateTokenOpts) (RestResponseDelegateTokenDetails, *http.Response, error) {
462467
var (
463468
localVarHttpMethod = strings.ToUpper("Put")
464469
localVarPostBody interface{}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# DelegateTokenDetails
2+
3+
## Properties
4+
Name | Type | Description | Notes
5+
------------ | ------------- | ------------- | -------------
6+
**Uuid** | **string** | | [optional] [default to null]
7+
**AccountId** | **string** | | [optional] [default to null]
8+
**Name** | **string** | | [optional] [default to null]
9+
**CreatedBy** | [***EmbeddedUser**](EmbeddedUser.md) | | [optional] [default to null]
10+
**CreatedByNgUser** | [***Principal**](Principal.md) | | [optional] [default to null]
11+
**CreatedAt** | **int64** | | [optional] [default to null]
12+
**Status** | **string** | | [optional] [default to null]
13+
**Value** | **string** | Value of delegate token. This is only populated when fetching delegate token by name or the user has edit delegate permission. | [optional] [default to null]
14+
**OwnerIdentifier** | **string** | | [optional] [default to null]
15+
**ParentUniqueId** | **string** | | [optional] [default to null]
16+
**RevokeAfter** | **int64** | | [optional] [default to null]
17+
18+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
19+
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# nextgen{{classname}}
2+
3+
All URIs are relative to *https://ng-manager-596c9d4b85-8dcb2/gateway/ng/api*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**CreateDelegateToken**](DelegateTokenResourceApi.md#CreateDelegateToken) | **Post** /delegate-token-ng | Creates Delegate Token.
8+
[**GetCgDelegateTokens**](DelegateTokenResourceApi.md#GetCgDelegateTokens) | **Get** /delegate-token-ng | Retrieves Delegate Tokens by Account, Organization, Project and status.
9+
[**GetDelegateGroupsUsingToken**](DelegateTokenResourceApi.md#GetDelegateGroupsUsingToken) | **Get** /delegate-token-ng/delegate-groups | Lists delegate groups that are using the specified delegate token.
10+
[**RevokeCgDelegateToken**](DelegateTokenResourceApi.md#RevokeCgDelegateToken) | **Put** /delegate-token-ng | Revokes Delegate Token.
11+
12+
# **CreateDelegateToken**
13+
> RestResponseDelegateTokenDetails CreateDelegateToken(ctx, accountIdentifier, tokenName, optional)
14+
Creates Delegate Token.
15+
16+
### Required Parameters
17+
18+
Name | Type | Description | Notes
19+
------------- | ------------- | ------------- | -------------
20+
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
21+
**accountIdentifier** | **string**| Account Identifier for the Entity. |
22+
**tokenName** | **string**| Delegate Token name |
23+
**optional** | ***DelegateTokenResourceApiCreateDelegateTokenOpts** | optional parameters | nil if no parameters
24+
25+
### Optional Parameters
26+
Optional parameters are passed through a pointer to a DelegateTokenResourceApiCreateDelegateTokenOpts struct
27+
Name | Type | Description | Notes
28+
------------- | ------------- | ------------- | -------------
29+
30+
31+
**orgIdentifier** | **optional.String**| Organization Identifier for the Entity. |
32+
**projectIdentifier** | **optional.String**| Project Identifier for the Entity. |
33+
**revokeAfter** | **optional.Int64**| Epoch time in milliseconds after which the token will be marked as revoked. There can be a delay of upto one hour from the epoch value provided and actual revoking of the token. |
34+
35+
### Return type
36+
37+
[**RestResponseDelegateTokenDetails**](RestResponseDelegateTokenDetails.md)
38+
39+
### Authorization
40+
41+
No authorization required
42+
43+
### HTTP request headers
44+
45+
- **Content-Type**: Not defined
46+
- **Accept**: application/json, application/yaml
47+
48+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
49+
50+
# **GetCgDelegateTokens**
51+
> RestResponseListDelegateTokenDetails GetCgDelegateTokens(ctx, accountIdentifier, optional)
52+
Retrieves Delegate Tokens by Account, Organization, Project and status.
53+
54+
### Required Parameters
55+
56+
Name | Type | Description | Notes
57+
------------- | ------------- | ------------- | -------------
58+
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
59+
**accountIdentifier** | **string**| Account Identifier for the Entity. |
60+
**optional** | ***DelegateTokenResourceApiGetCgDelegateTokensOpts** | optional parameters | nil if no parameters
61+
62+
### Optional Parameters
63+
Optional parameters are passed through a pointer to a DelegateTokenResourceApiGetCgDelegateTokensOpts struct
64+
Name | Type | Description | Notes
65+
------------- | ------------- | ------------- | -------------
66+
67+
**name** | **optional.String**| Name of Delegate Token (ACTIVE or REVOKED). |
68+
**orgIdentifier** | **optional.String**| Organization Identifier for the Entity. |
69+
**projectIdentifier** | **optional.String**| Project Identifier for the Entity. |
70+
**status** | **optional.String**| Status of Delegate Token (ACTIVE or REVOKED). If left empty both active and revoked tokens will be retrieved |
71+
72+
### Return type
73+
74+
[**RestResponseListDelegateTokenDetails**](RestResponseListDelegateTokenDetails.md)
75+
76+
### Authorization
77+
78+
No authorization required
79+
80+
### HTTP request headers
81+
82+
- **Content-Type**: Not defined
83+
- **Accept**: application/json, application/yaml
84+
85+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
86+
87+
# **GetDelegateGroupsUsingToken**
88+
> RestResponseDelegateGroupListing GetDelegateGroupsUsingToken(ctx, accountIdentifier, optional)
89+
Lists delegate groups that are using the specified delegate token.
90+
91+
### Required Parameters
92+
93+
Name | Type | Description | Notes
94+
------------- | ------------- | ------------- | -------------
95+
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
96+
**accountIdentifier** | **string**| Account Identifier for the Entity. |
97+
**optional** | ***DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts** | optional parameters | nil if no parameters
98+
99+
### Optional Parameters
100+
Optional parameters are passed through a pointer to a DelegateTokenResourceApiGetDelegateGroupsUsingTokenOpts struct
101+
Name | Type | Description | Notes
102+
------------- | ------------- | ------------- | -------------
103+
104+
**orgIdentifier** | **optional.String**| Organization Identifier for the Entity. |
105+
**projectIdentifier** | **optional.String**| Project Identifier for the Entity. |
106+
**delegateTokenName** | **optional.String**| Delegate Token name |
107+
108+
### Return type
109+
110+
[**RestResponseDelegateGroupListing**](RestResponseDelegateGroupListing.md)
111+
112+
### Authorization
113+
114+
No authorization required
115+
116+
### HTTP request headers
117+
118+
- **Content-Type**: Not defined
119+
- **Accept**: application/json, application/yaml
120+
121+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
122+
123+
# **RevokeCgDelegateToken**
124+
> RestResponseDelegateTokenDetails RevokeCgDelegateToken(ctx, accountIdentifier, tokenName, optional)
125+
Revokes Delegate Token.
126+
127+
### Required Parameters
128+
129+
Name | Type | Description | Notes
130+
------------- | ------------- | ------------- | -------------
131+
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
132+
**accountIdentifier** | **string**| Account Identifier for the Entity. |
133+
**tokenName** | **string**| Delegate Token name |
134+
**optional** | ***DelegateTokenResourceApiRevokeCgDelegateTokenOpts** | optional parameters | nil if no parameters
135+
136+
### Optional Parameters
137+
Optional parameters are passed through a pointer to a DelegateTokenResourceApiRevokeCgDelegateTokenOpts struct
138+
Name | Type | Description | Notes
139+
------------- | ------------- | ------------- | -------------
140+
141+
142+
**orgIdentifier** | **optional.String**| Organization Identifier for the Entity. |
143+
**projectIdentifier** | **optional.String**| Project Identifier for the Entity. |
144+
145+
### Return type
146+
147+
[**RestResponseDelegateTokenDetails**](RestResponseDelegateTokenDetails.md)
148+
149+
### Authorization
150+
151+
No authorization required
152+
153+
### HTTP request headers
154+
155+
- **Content-Type**: Not defined
156+
- **Accept**: application/json, application/yaml
157+
158+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
159+

0 commit comments

Comments
 (0)