Skip to content

Commit 5bb83ff

Browse files
authored
APIBot: SDK update based on recent changes in Atlas API (#177)
1 parent 802ab24 commit 5bb83ff

File tree

106 files changed

+5006
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5006
-509
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Note that `atlas-sdk-go` only supports the two most recent major versions of Go.
1111
### Adding Dependency
1212

1313
```terminal
14-
go get go.mongodb.org/atlas-sdk/v20230201005
14+
go get go.mongodb.org/atlas-sdk/v20230201006
1515
```
1616

1717
### Using in the code
@@ -20,7 +20,7 @@ Construct a new Atlas SDK client, then use the various services on the client to
2020
access different parts of the Atlas API. For example:
2121

2222
```go
23-
import "go.mongodb.org/atlas-sdk/v20230201005/admin"
23+
import "go.mongodb.org/atlas-sdk/v20230201006/admin"
2424

2525
func example() {
2626
ctx := context.Background()

admin/api_organizations.go

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,30 @@ type OrganizationsApi interface {
371371
// Interface only available internally
372372
updateOrganizationInvitationByIdExecute(r UpdateOrganizationInvitationByIdApiRequest) (*OrganizationInvitation, *http.Response, error)
373373

374+
/*
375+
UpdateOrganizationRoles Update Organization Roles for One MongoDB Cloud User
376+
377+
[experimental] Updates the roles of the specified user in the specified organization. To specify the user to update, provide the unique 24-hexadecimal digit string that identifies the user in the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role.
378+
379+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
380+
@param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
381+
@param userId Unique 24-hexadecimal digit string that identifies the user to modify.
382+
@return UpdateOrganizationRolesApiRequest
383+
*/
384+
UpdateOrganizationRoles(ctx context.Context, orgId string, userId string, updateOrgRolesForUser *UpdateOrgRolesForUser) UpdateOrganizationRolesApiRequest
385+
/*
386+
UpdateOrganizationRoles Update Organization Roles for One MongoDB Cloud User
387+
388+
389+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
390+
@param UpdateOrganizationRolesApiParams - Parameters for the request
391+
@return UpdateOrganizationRolesApiRequest
392+
*/
393+
UpdateOrganizationRolesWithParams(ctx context.Context, args *UpdateOrganizationRolesApiParams) UpdateOrganizationRolesApiRequest
394+
395+
// Interface only available internally
396+
updateOrganizationRolesExecute(r UpdateOrganizationRolesApiRequest) (*UpdateOrgRolesForUser, *http.Response, error)
397+
374398
/*
375399
UpdateOrganizationSettings Update Settings for One Organization
376400
@@ -2603,6 +2627,157 @@ func (a *OrganizationsApiService) updateOrganizationInvitationByIdExecute(r Upda
26032627
return localVarReturnValue, localVarHTTPResponse, nil
26042628
}
26052629

2630+
type UpdateOrganizationRolesApiRequest struct {
2631+
ctx context.Context
2632+
ApiService OrganizationsApi
2633+
orgId string
2634+
userId string
2635+
updateOrgRolesForUser *UpdateOrgRolesForUser
2636+
}
2637+
2638+
type UpdateOrganizationRolesApiParams struct {
2639+
OrgId string
2640+
UserId string
2641+
UpdateOrgRolesForUser *UpdateOrgRolesForUser
2642+
}
2643+
2644+
func (a *OrganizationsApiService) UpdateOrganizationRolesWithParams(ctx context.Context, args *UpdateOrganizationRolesApiParams) UpdateOrganizationRolesApiRequest {
2645+
return UpdateOrganizationRolesApiRequest{
2646+
ApiService: a,
2647+
ctx: ctx,
2648+
orgId: args.OrgId,
2649+
userId: args.UserId,
2650+
updateOrgRolesForUser: args.UpdateOrgRolesForUser,
2651+
}
2652+
}
2653+
2654+
func (r UpdateOrganizationRolesApiRequest) Execute() (*UpdateOrgRolesForUser, *http.Response, error) {
2655+
return r.ApiService.updateOrganizationRolesExecute(r)
2656+
}
2657+
2658+
/*
2659+
UpdateOrganizationRoles Update Organization Roles for One MongoDB Cloud User
2660+
2661+
[experimental] Updates the roles of the specified user in the specified organization. To specify the user to update, provide the unique 24-hexadecimal digit string that identifies the user in the specified organization. To use this resource, the requesting API Key must have the Organization User Admin role.
2662+
2663+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
2664+
@param orgId Unique 24-hexadecimal digit string that identifies the organization that contains your projects. Use the [/orgs](#tag/Organizations/operation/listOrganizations) endpoint to retrieve all organizations to which the authenticated user has access.
2665+
@param userId Unique 24-hexadecimal digit string that identifies the user to modify.
2666+
@return UpdateOrganizationRolesApiRequest
2667+
*/
2668+
func (a *OrganizationsApiService) UpdateOrganizationRoles(ctx context.Context, orgId string, userId string, updateOrgRolesForUser *UpdateOrgRolesForUser) UpdateOrganizationRolesApiRequest {
2669+
return UpdateOrganizationRolesApiRequest{
2670+
ApiService: a,
2671+
ctx: ctx,
2672+
orgId: orgId,
2673+
userId: userId,
2674+
updateOrgRolesForUser: updateOrgRolesForUser,
2675+
}
2676+
}
2677+
2678+
// Execute executes the request
2679+
//
2680+
// @return UpdateOrgRolesForUser
2681+
func (a *OrganizationsApiService) updateOrganizationRolesExecute(r UpdateOrganizationRolesApiRequest) (*UpdateOrgRolesForUser, *http.Response, error) {
2682+
var (
2683+
localVarHTTPMethod = http.MethodPut
2684+
localVarPostBody interface{}
2685+
formFiles []formFile
2686+
localVarReturnValue *UpdateOrgRolesForUser
2687+
)
2688+
2689+
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.UpdateOrganizationRoles")
2690+
if err != nil {
2691+
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
2692+
}
2693+
2694+
localVarPath := localBasePath + "/api/atlas/v2/orgs/{orgId}/users/{userId}/roles"
2695+
localVarPath = strings.Replace(localVarPath, "{"+"orgId"+"}", url.PathEscape(parameterValueToString(r.orgId, "orgId")), -1)
2696+
localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
2697+
2698+
localVarHeaderParams := make(map[string]string)
2699+
localVarQueryParams := url.Values{}
2700+
localVarFormParams := url.Values{}
2701+
if strlen(r.orgId) < 24 {
2702+
return localVarReturnValue, nil, reportError("orgId must have at least 24 elements")
2703+
}
2704+
if strlen(r.orgId) > 24 {
2705+
return localVarReturnValue, nil, reportError("orgId must have less than 24 elements")
2706+
}
2707+
if strlen(r.userId) < 24 {
2708+
return localVarReturnValue, nil, reportError("userId must have at least 24 elements")
2709+
}
2710+
if strlen(r.userId) > 24 {
2711+
return localVarReturnValue, nil, reportError("userId must have less than 24 elements")
2712+
}
2713+
if r.updateOrgRolesForUser == nil {
2714+
return localVarReturnValue, nil, reportError("updateOrgRolesForUser is required and must be specified")
2715+
}
2716+
2717+
// to determine the Content-Type header
2718+
localVarHTTPContentTypes := []string{"application/vnd.atlas.2023-01-01+json"}
2719+
2720+
// set Content-Type header
2721+
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
2722+
if localVarHTTPContentType != "" {
2723+
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2724+
}
2725+
2726+
// to determine the Accept header
2727+
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2023-01-01+json", "application/json"}
2728+
2729+
// set Accept header
2730+
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
2731+
if localVarHTTPHeaderAccept != "" {
2732+
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2733+
}
2734+
// body params
2735+
localVarPostBody = r.updateOrgRolesForUser
2736+
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2737+
if err != nil {
2738+
return localVarReturnValue, nil, err
2739+
}
2740+
2741+
localVarHTTPResponse, err := a.client.callAPI(req)
2742+
if err != nil || localVarHTTPResponse == nil {
2743+
return localVarReturnValue, localVarHTTPResponse, err
2744+
}
2745+
2746+
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
2747+
localVarHTTPResponse.Body.Close()
2748+
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2749+
if err != nil {
2750+
return localVarReturnValue, localVarHTTPResponse, err
2751+
}
2752+
2753+
if localVarHTTPResponse.StatusCode >= 300 {
2754+
newErr := &GenericOpenAPIError{
2755+
body: localVarBody,
2756+
error: localVarHTTPResponse.Status,
2757+
}
2758+
var v ApiError
2759+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2760+
if err != nil {
2761+
newErr.error = err.Error()
2762+
return localVarReturnValue, localVarHTTPResponse, newErr
2763+
}
2764+
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, localVarHTTPMethod, localVarPath, v)
2765+
newErr.model = v
2766+
return localVarReturnValue, localVarHTTPResponse, newErr
2767+
}
2768+
2769+
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
2770+
if err != nil {
2771+
newErr := &GenericOpenAPIError{
2772+
body: localVarBody,
2773+
error: err.Error(),
2774+
}
2775+
return localVarReturnValue, localVarHTTPResponse, newErr
2776+
}
2777+
2778+
return localVarReturnValue, localVarHTTPResponse, nil
2779+
}
2780+
26062781
type UpdateOrganizationSettingsApiRequest struct {
26072782
ctx context.Context
26082783
ApiService OrganizationsApi

admin/api_projects.go

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,30 @@ type ProjectsApi interface {
457457
// Interface only available internally
458458
updateProjectInvitationByIdExecute(r UpdateProjectInvitationByIdApiRequest) (*GroupInvitation, *http.Response, error)
459459

460+
/*
461+
UpdateProjectRoles Update Project Roles for One MongoDB Cloud User
462+
463+
[experimental] Updates the roles of the specified user in the specified project. To specify the user to update, provide the unique 24-hexadecimal digit string that identifies the user in the specified project. To use this resource, the requesting API Key must have the Group User Admin role.
464+
465+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
466+
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
467+
@param userId Unique 24-hexadecimal digit string that identifies the user to modify.
468+
@return UpdateProjectRolesApiRequest
469+
*/
470+
UpdateProjectRoles(ctx context.Context, groupId string, userId string, updateGroupRolesForUser *UpdateGroupRolesForUser) UpdateProjectRolesApiRequest
471+
/*
472+
UpdateProjectRoles Update Project Roles for One MongoDB Cloud User
473+
474+
475+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
476+
@param UpdateProjectRolesApiParams - Parameters for the request
477+
@return UpdateProjectRolesApiRequest
478+
*/
479+
UpdateProjectRolesWithParams(ctx context.Context, args *UpdateProjectRolesApiParams) UpdateProjectRolesApiRequest
480+
481+
// Interface only available internally
482+
updateProjectRolesExecute(r UpdateProjectRolesApiRequest) (*UpdateGroupRolesForUser, *http.Response, error)
483+
460484
/*
461485
UpdateProjectSettings Update One Project Settings
462486
@@ -3192,6 +3216,157 @@ func (a *ProjectsApiService) updateProjectInvitationByIdExecute(r UpdateProjectI
31923216
return localVarReturnValue, localVarHTTPResponse, nil
31933217
}
31943218

3219+
type UpdateProjectRolesApiRequest struct {
3220+
ctx context.Context
3221+
ApiService ProjectsApi
3222+
groupId string
3223+
userId string
3224+
updateGroupRolesForUser *UpdateGroupRolesForUser
3225+
}
3226+
3227+
type UpdateProjectRolesApiParams struct {
3228+
GroupId string
3229+
UserId string
3230+
UpdateGroupRolesForUser *UpdateGroupRolesForUser
3231+
}
3232+
3233+
func (a *ProjectsApiService) UpdateProjectRolesWithParams(ctx context.Context, args *UpdateProjectRolesApiParams) UpdateProjectRolesApiRequest {
3234+
return UpdateProjectRolesApiRequest{
3235+
ApiService: a,
3236+
ctx: ctx,
3237+
groupId: args.GroupId,
3238+
userId: args.UserId,
3239+
updateGroupRolesForUser: args.UpdateGroupRolesForUser,
3240+
}
3241+
}
3242+
3243+
func (r UpdateProjectRolesApiRequest) Execute() (*UpdateGroupRolesForUser, *http.Response, error) {
3244+
return r.ApiService.updateProjectRolesExecute(r)
3245+
}
3246+
3247+
/*
3248+
UpdateProjectRoles Update Project Roles for One MongoDB Cloud User
3249+
3250+
[experimental] Updates the roles of the specified user in the specified project. To specify the user to update, provide the unique 24-hexadecimal digit string that identifies the user in the specified project. To use this resource, the requesting API Key must have the Group User Admin role.
3251+
3252+
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
3253+
@param groupId Unique 24-hexadecimal digit string that identifies your project. Use the [/groups](#tag/Projects/operation/listProjects) endpoint to retrieve all projects to which the authenticated user has access. **NOTE**: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
3254+
@param userId Unique 24-hexadecimal digit string that identifies the user to modify.
3255+
@return UpdateProjectRolesApiRequest
3256+
*/
3257+
func (a *ProjectsApiService) UpdateProjectRoles(ctx context.Context, groupId string, userId string, updateGroupRolesForUser *UpdateGroupRolesForUser) UpdateProjectRolesApiRequest {
3258+
return UpdateProjectRolesApiRequest{
3259+
ApiService: a,
3260+
ctx: ctx,
3261+
groupId: groupId,
3262+
userId: userId,
3263+
updateGroupRolesForUser: updateGroupRolesForUser,
3264+
}
3265+
}
3266+
3267+
// Execute executes the request
3268+
//
3269+
// @return UpdateGroupRolesForUser
3270+
func (a *ProjectsApiService) updateProjectRolesExecute(r UpdateProjectRolesApiRequest) (*UpdateGroupRolesForUser, *http.Response, error) {
3271+
var (
3272+
localVarHTTPMethod = http.MethodPut
3273+
localVarPostBody interface{}
3274+
formFiles []formFile
3275+
localVarReturnValue *UpdateGroupRolesForUser
3276+
)
3277+
3278+
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ProjectsApiService.UpdateProjectRoles")
3279+
if err != nil {
3280+
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
3281+
}
3282+
3283+
localVarPath := localBasePath + "/api/atlas/v2/groups/{groupId}/users/{userId}/roles"
3284+
localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", url.PathEscape(parameterValueToString(r.groupId, "groupId")), -1)
3285+
localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1)
3286+
3287+
localVarHeaderParams := make(map[string]string)
3288+
localVarQueryParams := url.Values{}
3289+
localVarFormParams := url.Values{}
3290+
if strlen(r.groupId) < 24 {
3291+
return localVarReturnValue, nil, reportError("groupId must have at least 24 elements")
3292+
}
3293+
if strlen(r.groupId) > 24 {
3294+
return localVarReturnValue, nil, reportError("groupId must have less than 24 elements")
3295+
}
3296+
if strlen(r.userId) < 24 {
3297+
return localVarReturnValue, nil, reportError("userId must have at least 24 elements")
3298+
}
3299+
if strlen(r.userId) > 24 {
3300+
return localVarReturnValue, nil, reportError("userId must have less than 24 elements")
3301+
}
3302+
if r.updateGroupRolesForUser == nil {
3303+
return localVarReturnValue, nil, reportError("updateGroupRolesForUser is required and must be specified")
3304+
}
3305+
3306+
// to determine the Content-Type header
3307+
localVarHTTPContentTypes := []string{"application/vnd.atlas.2023-01-01+json"}
3308+
3309+
// set Content-Type header
3310+
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
3311+
if localVarHTTPContentType != "" {
3312+
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
3313+
}
3314+
3315+
// to determine the Accept header
3316+
localVarHTTPHeaderAccepts := []string{"application/vnd.atlas.2023-01-01+json", "application/json"}
3317+
3318+
// set Accept header
3319+
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
3320+
if localVarHTTPHeaderAccept != "" {
3321+
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
3322+
}
3323+
// body params
3324+
localVarPostBody = r.updateGroupRolesForUser
3325+
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
3326+
if err != nil {
3327+
return localVarReturnValue, nil, err
3328+
}
3329+
3330+
localVarHTTPResponse, err := a.client.callAPI(req)
3331+
if err != nil || localVarHTTPResponse == nil {
3332+
return localVarReturnValue, localVarHTTPResponse, err
3333+
}
3334+
3335+
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
3336+
localVarHTTPResponse.Body.Close()
3337+
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
3338+
if err != nil {
3339+
return localVarReturnValue, localVarHTTPResponse, err
3340+
}
3341+
3342+
if localVarHTTPResponse.StatusCode >= 300 {
3343+
newErr := &GenericOpenAPIError{
3344+
body: localVarBody,
3345+
error: localVarHTTPResponse.Status,
3346+
}
3347+
var v ApiError
3348+
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
3349+
if err != nil {
3350+
newErr.error = err.Error()
3351+
return localVarReturnValue, localVarHTTPResponse, newErr
3352+
}
3353+
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, localVarHTTPMethod, localVarPath, v)
3354+
newErr.model = v
3355+
return localVarReturnValue, localVarHTTPResponse, newErr
3356+
}
3357+
3358+
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
3359+
if err != nil {
3360+
newErr := &GenericOpenAPIError{
3361+
body: localVarBody,
3362+
error: err.Error(),
3363+
}
3364+
return localVarReturnValue, localVarHTTPResponse, newErr
3365+
}
3366+
3367+
return localVarReturnValue, localVarHTTPResponse, nil
3368+
}
3369+
31953370
type UpdateProjectSettingsApiRequest struct {
31963371
ctx context.Context
31973372
ApiService ProjectsApi

0 commit comments

Comments
 (0)