diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d9c6aa1ce1f..8e5da58d0b6 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -81676,55 +81676,57 @@ components: description: Attributes of user object returned by the API. properties: created_at: - description: Creation time of the user. + description: The ISO 8601 timestamp of when the user account was created. format: date-time type: string disabled: - description: Whether the user is disabled. + description: Whether the user account is deactivated. Disabled users cannot log in. type: boolean email: - description: Email of the user. + description: The email address of the user, used for login and notifications. type: string handle: - description: Handle of the user. + description: The unique handle (username) of the user, typically matching their email prefix. type: string icon: - description: URL of the user's icon. + description: URL of the user's profile icon, typically a Gravatar URL derived from the email address. type: string last_login_time: - description: The last time the user logged in. + description: The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in. format: date-time nullable: true readOnly: true type: string mfa_enabled: - description: If user has MFA enabled. + description: Whether multi-factor authentication (MFA) is enabled for the user's account. readOnly: true type: boolean modified_at: - description: Time that the user was last modified. + description: The ISO 8601 timestamp of when the user account was last modified. format: date-time type: string name: - description: Name of the user. + description: The full display name of the user as shown in the Datadog UI. nullable: true type: string service_account: - description: Whether the user is a service account. + description: |- + Whether this is a service account rather than a human user. + Service accounts are used for programmatic API access. type: boolean status: - description: Status of the user. + description: The current status of the user account (for example, `Active`, `Pending`, or `Disabled`). type: string title: - description: Title of the user. + description: The job title of the user (for example, "Senior Engineer" or "Product Manager"). nullable: true type: string uuid: - description: UUID of the user. + description: The globally unique identifier (UUID) of the user. readOnly: true type: string verified: - description: Whether the user is verified. + description: Whether the user's email address has been verified. type: boolean type: object UserAttributesStatus: @@ -82126,13 +82128,23 @@ components: description: Attributes of the edited user. properties: disabled: - description: If the user is enabled or disabled. + description: |- + When set to `true`, the user is deactivated and can no longer log in. + When `false`, the user is active. type: boolean email: - description: The email of the user. + description: |- + The email address of the user, used for login and notifications. + Must be a valid email format. type: string name: - description: The name of the user. + description: |- + The full display name of the user as shown in the Datadog UI. + Maximum 55 characters, cannot contain `<` or `>`. + type: string + title: + description: The job title of the user (for example, "Senior Engineer" or "Product Manager"). + nullable: true type: string type: object UserUpdateData: @@ -96994,6 +97006,144 @@ paths: $ref: "#/components/responses/TooManyRequestsResponse" summary: Get all CSM Serverless Agents tags: ["CSM Agents"] + /api/v2/current_user: + get: + description: |- + Get the user associated with the current authentication context. + The response includes the user's profile attributes (name, email, handle, + status, MFA state), along with related resources: the user's organization, + assigned roles with their granted permissions, and team-scoped roles. + No additional permissions are required beyond valid authentication. + operationId: GetCurrentUser + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T10:30:00+00:00" + disabled: false + email: jane.doe@example.com + handle: jane.doe + icon: "https://secure.gravatar.com/avatar/abc123" + mfa_enabled: true + modified_at: "2024-06-01T12:00:00+00:00" + name: Jane Doe + service_account: false + status: Active + title: Senior Engineer + verified: true + id: 00000000-0000-9999-0000-000000000000 + type: users + included: [] + schema: + $ref: "#/components/schemas/UserResponse" + description: OK + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Authentication error + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Get current user + tags: + - Users + patch: + description: |- + Edit the profile of the currently authenticated user. Updatable fields + include `name`, `title`, `email`, and `disabled` status. The `id` field + in the request body must match the authenticated user's UUID; a mismatch + returns a 422 error. Email address changes are recorded in the audit trail. + Requires the `user_self_profile_write` permission. + operationId: UpdateCurrentUser + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + email: jane.doe@example.com + name: Jane Doe + title: Staff Engineer + id: 00000000-0000-9999-0000-000000000000 + type: users + schema: + $ref: "#/components/schemas/UserUpdateRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-15T10:30:00+00:00" + disabled: false + email: jane.doe@example.com + handle: jane.doe + icon: "https://secure.gravatar.com/avatar/abc123" + mfa_enabled: true + modified_at: "2024-06-01T12:00:00+00:00" + name: Jane Doe + service_account: false + status: Active + title: Staff Engineer + verified: true + id: 00000000-0000-9999-0000-000000000000 + type: users + included: [] + schema: + $ref: "#/components/schemas/UserResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Authentication error + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not found + "422": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Unprocessable Entity + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update current user + tags: + - Users + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - user_self_profile_write /api/v2/current_user/application_keys: get: description: List all application keys available for current user diff --git a/api/datadogV2/api_users.go b/api/datadogV2/api_users.go index 52b5583c1b5..a208e864ff0 100644 --- a/api/datadogV2/api_users.go +++ b/api/datadogV2/api_users.go @@ -326,6 +326,87 @@ func (a *UsersApi) DisableUser(ctx _context.Context, userId string) (*_nethttp.R return localVarHTTPResponse, nil } +// GetCurrentUser Get current user. +// Get the user associated with the current authentication context. +// The response includes the user's profile attributes (name, email, handle, +// status, MFA state), along with related resources: the user's organization, +// assigned roles with their granted permissions, and team-scoped roles. +// No additional permissions are required beyond valid authentication. +func (a *UsersApi) GetCurrentUser(ctx _context.Context) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.UsersApi.GetCurrentUser") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // GetInvitation Get a user invitation. // Returns a single user invitation by its UUID. func (a *UsersApi) GetInvitation(ctx _context.Context, userInvitationUuid string) (UserInvitationResponse, *_nethttp.Response, error) { @@ -924,6 +1005,90 @@ func (a *UsersApi) SendInvitations(ctx _context.Context, body UserInvitationsReq return localVarReturnValue, localVarHTTPResponse, nil } +// UpdateCurrentUser Update current user. +// Edit the profile of the currently authenticated user. Updatable fields +// include `name`, `title`, `email`, and `disabled` status. The `id` field +// in the request body must match the authenticated user's UUID; a mismatch +// returns a 422 error. Email address changes are recorded in the audit trail. +// Requires the `user_self_profile_write` permission. +func (a *UsersApi) UpdateCurrentUser(ctx _context.Context, body UserUpdateRequest) (UserResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue UserResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.UsersApi.UpdateCurrentUser") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/current_user" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 422 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // UpdateUser Update a user. // Edit a user. Can only be used with an application key belonging // to an administrator user. diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 28a5aac4472..14d59a40416 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -1011,12 +1011,14 @@ // - [UsersApi.CreateUser] // - [UsersApi.DeleteUserInvitations] // - [UsersApi.DisableUser] +// - [UsersApi.GetCurrentUser] // - [UsersApi.GetInvitation] // - [UsersApi.GetUser] // - [UsersApi.ListUserOrganizations] // - [UsersApi.ListUserPermissions] // - [UsersApi.ListUsers] // - [UsersApi.SendInvitations] +// - [UsersApi.UpdateCurrentUser] // - [UsersApi.UpdateUser] // - [WebIntegrationsApi.CreateWebIntegrationAccount] // - [WebIntegrationsApi.DeleteWebIntegrationAccount] diff --git a/api/datadogV2/model_user_attributes.go b/api/datadogV2/model_user_attributes.go index ca100381561..8c2416d6d52 100644 --- a/api/datadogV2/model_user_attributes.go +++ b/api/datadogV2/model_user_attributes.go @@ -12,33 +12,34 @@ import ( // UserAttributes Attributes of user object returned by the API. type UserAttributes struct { - // Creation time of the user. + // The ISO 8601 timestamp of when the user account was created. CreatedAt *time.Time `json:"created_at,omitempty"` - // Whether the user is disabled. + // Whether the user account is deactivated. Disabled users cannot log in. Disabled *bool `json:"disabled,omitempty"` - // Email of the user. + // The email address of the user, used for login and notifications. Email *string `json:"email,omitempty"` - // Handle of the user. + // The unique handle (username) of the user, typically matching their email prefix. Handle *string `json:"handle,omitempty"` - // URL of the user's icon. + // URL of the user's profile icon, typically a Gravatar URL derived from the email address. Icon *string `json:"icon,omitempty"` - // The last time the user logged in. + // The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in. LastLoginTime datadog.NullableTime `json:"last_login_time,omitempty"` - // If user has MFA enabled. + // Whether multi-factor authentication (MFA) is enabled for the user's account. MfaEnabled *bool `json:"mfa_enabled,omitempty"` - // Time that the user was last modified. + // The ISO 8601 timestamp of when the user account was last modified. ModifiedAt *time.Time `json:"modified_at,omitempty"` - // Name of the user. + // The full display name of the user as shown in the Datadog UI. Name datadog.NullableString `json:"name,omitempty"` - // Whether the user is a service account. + // Whether this is a service account rather than a human user. + // Service accounts are used for programmatic API access. ServiceAccount *bool `json:"service_account,omitempty"` - // Status of the user. + // The current status of the user account (for example, `Active`, `Pending`, or `Disabled`). Status *string `json:"status,omitempty"` - // Title of the user. + // The job title of the user (for example, "Senior Engineer" or "Product Manager"). Title datadog.NullableString `json:"title,omitempty"` - // UUID of the user. + // The globally unique identifier (UUID) of the user. Uuid *string `json:"uuid,omitempty"` - // Whether the user is verified. + // Whether the user's email address has been verified. Verified *bool `json:"verified,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/api/datadogV2/model_user_update_attributes.go b/api/datadogV2/model_user_update_attributes.go index 916b82a347d..beab31d5613 100644 --- a/api/datadogV2/model_user_update_attributes.go +++ b/api/datadogV2/model_user_update_attributes.go @@ -10,12 +10,17 @@ import ( // UserUpdateAttributes Attributes of the edited user. type UserUpdateAttributes struct { - // If the user is enabled or disabled. + // When set to `true`, the user is deactivated and can no longer log in. + // When `false`, the user is active. Disabled *bool `json:"disabled,omitempty"` - // The email of the user. + // The email address of the user, used for login and notifications. + // Must be a valid email format. Email *string `json:"email,omitempty"` - // The name of the user. + // The full display name of the user as shown in the Datadog UI. + // Maximum 55 characters, cannot contain `<` or `>`. Name *string `json:"name,omitempty"` + // The job title of the user (for example, "Senior Engineer" or "Product Manager"). + Title datadog.NullableString `json:"title,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -122,6 +127,45 @@ func (o *UserUpdateAttributes) SetName(v string) { o.Name = &v } +// GetTitle returns the Title field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UserUpdateAttributes) GetTitle() string { + if o == nil || o.Title.Get() == nil { + var ret string + return ret + } + return *o.Title.Get() +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *UserUpdateAttributes) GetTitleOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Title.Get(), o.Title.IsSet() +} + +// HasTitle returns a boolean if a field has been set. +func (o *UserUpdateAttributes) HasTitle() bool { + return o != nil && o.Title.IsSet() +} + +// SetTitle gets a reference to the given datadog.NullableString and assigns it to the Title field. +func (o *UserUpdateAttributes) SetTitle(v string) { + o.Title.Set(&v) +} + +// SetTitleNil sets the value for Title to be an explicit nil. +func (o *UserUpdateAttributes) SetTitleNil() { + o.Title.Set(nil) +} + +// UnsetTitle ensures that no value is present for Title, not even an explicit nil. +func (o *UserUpdateAttributes) UnsetTitle() { + o.Title.Unset() +} + // MarshalJSON serializes the struct using spec logic. func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -137,6 +181,9 @@ func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { if o.Name != nil { toSerialize["name"] = o.Name } + if o.Title.IsSet() { + toSerialize["title"] = o.Title.Get() + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -147,22 +194,24 @@ func (o UserUpdateAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *UserUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Disabled *bool `json:"disabled,omitempty"` - Email *string `json:"email,omitempty"` - Name *string `json:"name,omitempty"` + Disabled *bool `json:"disabled,omitempty"` + Email *string `json:"email,omitempty"` + Name *string `json:"name,omitempty"` + Title datadog.NullableString `json:"title,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"disabled", "email", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"disabled", "email", "name", "title"}) } else { return err } o.Disabled = all.Disabled o.Email = all.Email o.Name = all.Name + o.Title = all.Title if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/examples/v2/users/GetCurrentUser.go b/examples/v2/users/GetCurrentUser.go new file mode 100644 index 00000000000..eb0406029e6 --- /dev/null +++ b/examples/v2/users/GetCurrentUser.go @@ -0,0 +1,29 @@ +// Get current 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() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewUsersApi(apiClient) + resp, r, err := api.GetCurrentUser(ctx) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetCurrentUser`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetCurrentUser`:\n%s\n", responseContent) +} diff --git a/examples/v2/users/UpdateCurrentUser.go b/examples/v2/users/UpdateCurrentUser.go new file mode 100644 index 00000000000..766385d0ca5 --- /dev/null +++ b/examples/v2/users/UpdateCurrentUser.go @@ -0,0 +1,38 @@ +// Update current 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() { + body := datadogV2.UserUpdateRequest{ + Data: datadogV2.UserUpdateData{ + Attributes: datadogV2.UserUpdateAttributes{ + Title: *datadog.NewNullableString(nil), + }, + Id: "00000000-0000-feed-0000-000000000000", + Type: datadogV2.USERSTYPE_USERS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewUsersApi(apiClient) + resp, r, err := api.UpdateCurrentUser(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.UpdateCurrentUser`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `UsersApi.UpdateCurrentUser`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index b09c0b4eb02..8b88a21beda 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -1506,6 +1506,19 @@ "type": "safe" } }, + "GetCurrentUser": { + "tag": "Users", + "undo": { + "type": "safe" + } + }, + "UpdateCurrentUser": { + "tag": "Users", + "undo": { + "operationId": "GetCurrentUser", + "type": "idempotent" + } + }, "ListCurrentUserApplicationKeys": { "tag": "Key Management", "undo": { diff --git a/tests/scenarios/features/v2/users.feature b/tests/scenarios/features/v2/users.feature index 2fee7ffedce..9d9fa489635 100644 --- a/tests/scenarios/features/v2/users.feature +++ b/tests/scenarios/features/v2/users.feature @@ -118,6 +118,12 @@ Feature: Users Then the response status is 200 OK And the response "data" has length 0 + @generated @skip @team:DataDog/org-management + Scenario: Get current user returns "OK" response + Given new "GetCurrentUser" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/org-management Scenario: Get user details returns "Not found" response Given new "GetUser" request @@ -181,7 +187,7 @@ Feature: Users Scenario: Update a user returns "Bad Request" response Given new "UpdateUser" request And request contains "user_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} When the request is sent Then the response status is 400 Bad Request @@ -219,6 +225,34 @@ Feature: Users Scenario: Update a user returns "Unprocessable Entity" response Given new "UpdateUser" request And request contains "user_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + When the request is sent + Then the response status is 422 Unprocessable Entity + + @generated @skip @team:DataDog/org-management + Scenario: Update current user returns "Bad Request" response + Given new "UpdateCurrentUser" request + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/org-management + Scenario: Update current user returns "Not found" response + Given new "UpdateCurrentUser" request + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + When the request is sent + Then the response status is 404 Not found + + @generated @skip @team:DataDog/org-management + Scenario: Update current user returns "OK" response + Given new "UpdateCurrentUser" request + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/org-management + Scenario: Update current user returns "Unprocessable Entity" response + Given new "UpdateCurrentUser" request + And body with value {"data": {"attributes": {"title": null}, "id": "00000000-0000-feed-0000-000000000000", "type": "users"}} When the request is sent Then the response status is 422 Unprocessable Entity