Skip to content

Commit

Permalink
Cleanup service accounts tests (#2229)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Oct 13, 2023
1 parent 23de4a7 commit 81d88ff
Show file tree
Hide file tree
Showing 31 changed files with 419 additions and 609 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-12 21:14:55.820882",
"spec_repo_commit": "d4c17bf0"
"regenerated": "2023-10-13 08:13:45.929351",
"spec_repo_commit": "30a99088"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-12 21:14:55.840828",
"spec_repo_commit": "d4c17bf0"
"regenerated": "2023-10-13 08:13:45.964694",
"spec_repo_commit": "30a99088"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ import (
)

func main() {
// there is a valid "service_account_user" in the system
ServiceAccountUserDataID := os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")

body := datadogV2.ApplicationKeyCreateRequest{
Data: datadogV2.ApplicationKeyCreateData{
Attributes: datadogV2.ApplicationKeyCreateAttributes{
Name: "Application Key for managing dashboards",
Scopes: *datadog.NewNullableList(&[]string{
"dashboards_read",
"dashboards_write",
"dashboards_public_share",
}),
Name: "Example-Service-Account",
},
Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
},
Expand All @@ -30,7 +28,7 @@ func main() {
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewServiceAccountsApi(apiClient)
resp, r, err := api.CreateServiceAccountApplicationKey(ctx, "00000000-0000-1234-0000-000000000000", body)
resp, r, err := api.CreateServiceAccountApplicationKey(ctx, ServiceAccountUserDataID, body)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAccountsApi.CreateServiceAccountApplicationKey`: %v\n", err)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ import (
)

func main() {
// there is a valid "service_account_user" in the system
ServiceAccountUserDataID := os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")

// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID := os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")

ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewServiceAccountsApi(apiClient)
r, err := api.DeleteServiceAccountApplicationKey(ctx, "00000000-0000-1234-0000-000000000000", "app_key_id")
r, err := api.DeleteServiceAccountApplicationKey(ctx, ServiceAccountUserDataID, ServiceAccountApplicationKeyDataID)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAccountsApi.DeleteServiceAccountApplicationKey`: %v\n", err)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ import (
)

func main() {
// there is a valid "service_account_user" in the system
ServiceAccountUserDataID := os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")

// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID := os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")

ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewServiceAccountsApi(apiClient)
resp, r, err := api.GetServiceAccountApplicationKey(ctx, "00000000-0000-1234-0000-000000000000", "app_key_id")
resp, r, err := api.GetServiceAccountApplicationKey(ctx, ServiceAccountUserDataID, ServiceAccountApplicationKeyDataID)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAccountsApi.GetServiceAccountApplicationKey`: %v\n", err)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ import (
)

func main() {
// there is a valid "service_account_user" in the system
ServiceAccountUserDataID := os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")

ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewServiceAccountsApi(apiClient)
resp, r, err := api.ListServiceAccountApplicationKeys(ctx, "00000000-0000-1234-0000-000000000000", *datadogV2.NewListServiceAccountApplicationKeysOptionalParameters())
resp, r, err := api.ListServiceAccountApplicationKeys(ctx, ServiceAccountUserDataID, *datadogV2.NewListServiceAccountApplicationKeysOptionalParameters())

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAccountsApi.ListServiceAccountApplicationKeys`: %v\n", err)
Expand Down

This file was deleted.

19 changes: 10 additions & 9 deletions examples/v2/service-accounts/UpdateServiceAccountApplicationKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ import (
)

func main() {
// there is a valid "service_account_user" in the system
ServiceAccountUserDataID := os.Getenv("SERVICE_ACCOUNT_USER_DATA_ID")

// there is a valid "service_account_application_key" for "service_account_user"
ServiceAccountApplicationKeyDataID := os.Getenv("SERVICE_ACCOUNT_APPLICATION_KEY_DATA_ID")

body := datadogV2.ApplicationKeyUpdateRequest{
Data: datadogV2.ApplicationKeyUpdateData{
Id: ServiceAccountApplicationKeyDataID,
Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
Attributes: datadogV2.ApplicationKeyUpdateAttributes{
Name: datadog.PtrString("Application Key for managing dashboards"),
Scopes: *datadog.NewNullableList(&[]string{
"dashboards_read",
"dashboards_write",
"dashboards_public_share",
}),
Name: datadog.PtrString("Application Key for managing dashboards-updated"),
},
Id: "00112233-4455-6677-8899-aabbccddeeff",
Type: datadogV2.APPLICATIONKEYSTYPE_APPLICATION_KEYS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewServiceAccountsApi(apiClient)
resp, r, err := api.UpdateServiceAccountApplicationKey(ctx, "00000000-0000-1234-0000-000000000000", "app_key_id", body)
resp, r, err := api.UpdateServiceAccountApplicationKey(ctx, ServiceAccountUserDataID, ServiceAccountApplicationKeyDataID, body)

if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ServiceAccountsApi.UpdateServiceAccountApplicationKey`: %v\n", err)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 81d88ff

Please sign in to comment.