diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496..32b9503e620 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -72918,9 +72918,13 @@ paths: - apiKeyAuth: [] appKeyAuth: [] - AuthZ: [] - summary: Get the schedule on-call user + summary: Get the scheduled on-call user tags: - On-Call + x-permission: + operator: AND + permissions: + - on_call_read /api/v2/on-call/teams/{team_id}/on-call: get: description: Get a team's on-call users at a given time @@ -72963,6 +72967,10 @@ paths: summary: Get team on-call users tags: - On-Call + x-permission: + operator: AND + permissions: + - on_call_read /api/v2/on-call/teams/{team_id}/routing-rules: get: description: Get a team's On-Call routing rules diff --git a/api/datadogV2/api_on_call.go b/api/datadogV2/api_on_call.go index f013983d9ba..3c11e4c9898 100644 --- a/api/datadogV2/api_on_call.go +++ b/api/datadogV2/api_on_call.go @@ -709,7 +709,7 @@ func (r *GetScheduleOnCallUserOptionalParameters) WithFilterAtTs(filterAtTs stri return r } -// GetScheduleOnCallUser Get the schedule on-call user. +// GetScheduleOnCallUser Get the scheduled on-call user. // Retrieves the user who is on-call for the specified schedule at a given time. func (a *OnCallApi) GetScheduleOnCallUser(ctx _context.Context, scheduleId string, o ...GetScheduleOnCallUserOptionalParameters) (Shift, *_nethttp.Response, error) { var ( diff --git a/examples/v2/on-call/GetScheduleOnCallUser.go b/examples/v2/on-call/GetScheduleOnCallUser.go index f09a5ae6a11..c4ed7dd19e0 100644 --- a/examples/v2/on-call/GetScheduleOnCallUser.go +++ b/examples/v2/on-call/GetScheduleOnCallUser.go @@ -1,4 +1,4 @@ -// Get the schedule on-call user returns "OK" response +// Get the scheduled on-call user returns "OK" response package main @@ -13,14 +13,11 @@ import ( ) func main() { - // there is a valid "schedule" in the system - ScheduleDataID := os.Getenv("SCHEDULE_DATA_ID") - ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() apiClient := datadog.NewAPIClient(configuration) api := datadogV2.NewOnCallApi(apiClient) - resp, r, err := api.GetScheduleOnCallUser(ctx, ScheduleDataID, *datadogV2.NewGetScheduleOnCallUserOptionalParameters()) + resp, r, err := api.GetScheduleOnCallUser(ctx, "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", *datadogV2.NewGetScheduleOnCallUserOptionalParameters()) if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OnCallApi.GetScheduleOnCallUser`: %v\n", err) diff --git a/examples/v2/on-call/GetScheduleOnCallUser_3672445524.go b/examples/v2/on-call/GetScheduleOnCallUser_3672445524.go new file mode 100644 index 00000000000..f09a5ae6a11 --- /dev/null +++ b/examples/v2/on-call/GetScheduleOnCallUser_3672445524.go @@ -0,0 +1,32 @@ +// Get the schedule on-call user returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "schedule" in the system + ScheduleDataID := os.Getenv("SCHEDULE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewOnCallApi(apiClient) + resp, r, err := api.GetScheduleOnCallUser(ctx, ScheduleDataID, *datadogV2.NewGetScheduleOnCallUserOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `OnCallApi.GetScheduleOnCallUser`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `OnCallApi.GetScheduleOnCallUser`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/on-call.feature b/tests/scenarios/features/v2/on-call.feature index 39640938e4a..251f00fae40 100644 --- a/tests/scenarios/features/v2/on-call.feature +++ b/tests/scenarios/features/v2/on-call.feature @@ -153,26 +153,33 @@ Feature: On-Call When the request is sent Then the response status is 200 OK + @team:DataDog/on-call + Scenario: Get the schedule on-call user returns "OK" response + Given new "GetScheduleOnCallUser" request + And there is a valid "user" in the system + And there is a valid "schedule" in the system + And request contains "schedule_id" parameter from "schedule.data.id" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "Bad Request" response + Scenario: Get the scheduled on-call user returns "Bad Request" response Given new "GetScheduleOnCallUser" request And request contains "schedule_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "Not Found" response + Scenario: Get the scheduled on-call user returns "Not Found" response Given new "GetScheduleOnCallUser" request And request contains "schedule_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 404 Not Found - @team:DataDog/on-call - Scenario: Get the schedule on-call user returns "OK" response + @generated @skip @team:DataDog/on-call + Scenario: Get the scheduled on-call user returns "OK" response Given new "GetScheduleOnCallUser" request - And there is a valid "user" in the system - And there is a valid "schedule" in the system - And request contains "schedule_id" parameter from "schedule.data.id" + And request contains "schedule_id" parameter from "REPLACE.ME" When the request is sent Then the response status is 200 OK