Skip to content

Commit

Permalink
APIBot: SDK update based on recent changes in Atlas API (#321)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: wtrocki <981838+wtrocki@users.noreply.github.com>
  • Loading branch information
3 people committed May 1, 2024
1 parent ecfd1a3 commit 30e92c7
Show file tree
Hide file tree
Showing 130 changed files with 828 additions and 468 deletions.
2 changes: 1 addition & 1 deletion .mockery.yaml
Expand Up @@ -6,6 +6,6 @@ filename: "{{ .InterfaceName | snakecase }}.go"
mockname: "{{.InterfaceName}}"

packages:
go.mongodb.org/atlas-sdk/v20231115012/admin:
go.mongodb.org/atlas-sdk/v20231115013/admin:
config:
include-regex: ".*Api"
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -12,7 +12,7 @@ Note that `atlas-sdk-go` only supports the two most recent major versions of Go.
### Adding Dependency

```terminal
go get go.mongodb.org/atlas-sdk/v20231115012
go get go.mongodb.org/atlas-sdk/v20231115013
```

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

```go
import "go.mongodb.org/atlas-sdk/v20231115012/admin"
import "go.mongodb.org/atlas-sdk/v20231115013/admin"

func example() {
ctx := context.Background()
Expand Down
42 changes: 37 additions & 5 deletions admin/api_federated_authentication.go
Expand Up @@ -278,7 +278,7 @@ type FederatedAuthenticationApi interface {
ListConnectedOrgConfigsWithParams(ctx context.Context, args *ListConnectedOrgConfigsApiParams) ListConnectedOrgConfigsApiRequest

// Method available only for mocking purposes
ListConnectedOrgConfigsExecute(r ListConnectedOrgConfigsApiRequest) ([]ConnectedOrgConfig, *http.Response, error)
ListConnectedOrgConfigsExecute(r ListConnectedOrgConfigsApiRequest) (*PaginatedConnectedOrgConfigs, *http.Response, error)

/*
ListIdentityProviders Return all identity providers from the specified federation.
Expand Down Expand Up @@ -1748,21 +1748,39 @@ type ListConnectedOrgConfigsApiRequest struct {
ctx context.Context
ApiService FederatedAuthenticationApi
federationSettingsId string
itemsPerPage *int
pageNum *int
}

type ListConnectedOrgConfigsApiParams struct {
FederationSettingsId string
ItemsPerPage *int
PageNum *int
}

func (a *FederatedAuthenticationApiService) ListConnectedOrgConfigsWithParams(ctx context.Context, args *ListConnectedOrgConfigsApiParams) ListConnectedOrgConfigsApiRequest {
return ListConnectedOrgConfigsApiRequest{
ApiService: a,
ctx: ctx,
federationSettingsId: args.FederationSettingsId,
itemsPerPage: args.ItemsPerPage,
pageNum: args.PageNum,
}
}

func (r ListConnectedOrgConfigsApiRequest) Execute() ([]ConnectedOrgConfig, *http.Response, error) {
// Number of items that the response returns per page.
func (r ListConnectedOrgConfigsApiRequest) ItemsPerPage(itemsPerPage int) ListConnectedOrgConfigsApiRequest {
r.itemsPerPage = &itemsPerPage
return r
}

// Number of the page that displays the current set of the total objects that the response returns.
func (r ListConnectedOrgConfigsApiRequest) PageNum(pageNum int) ListConnectedOrgConfigsApiRequest {
r.pageNum = &pageNum
return r
}

func (r ListConnectedOrgConfigsApiRequest) Execute() (*PaginatedConnectedOrgConfigs, *http.Response, error) {
return r.ApiService.ListConnectedOrgConfigsExecute(r)
}

Expand All @@ -1785,13 +1803,13 @@ func (a *FederatedAuthenticationApiService) ListConnectedOrgConfigs(ctx context.

// Execute executes the request
//
// @return []ConnectedOrgConfig
func (a *FederatedAuthenticationApiService) ListConnectedOrgConfigsExecute(r ListConnectedOrgConfigsApiRequest) ([]ConnectedOrgConfig, *http.Response, error) {
// @return PaginatedConnectedOrgConfigs
func (a *FederatedAuthenticationApiService) ListConnectedOrgConfigsExecute(r ListConnectedOrgConfigsApiRequest) (*PaginatedConnectedOrgConfigs, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue []ConnectedOrgConfig
localVarReturnValue *PaginatedConnectedOrgConfigs
)

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FederatedAuthenticationApiService.ListConnectedOrgConfigs")
Expand All @@ -1806,6 +1824,20 @@ func (a *FederatedAuthenticationApiService) ListConnectedOrgConfigsExecute(r Lis
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}

if r.itemsPerPage != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
} else {
var defaultValue int = 100
r.itemsPerPage = &defaultValue
parameterAddToHeaderOrQuery(localVarQueryParams, "itemsPerPage", r.itemsPerPage, "")
}
if r.pageNum != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
} else {
var defaultValue int = 1
r.pageNum = &defaultValue
parameterAddToHeaderOrQuery(localVarQueryParams, "pageNum", r.pageNum, "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}

Expand Down
4 changes: 2 additions & 2 deletions admin/atlas_client.go
@@ -1,4 +1,4 @@
package admin // import "go.mongodb.org/atlas-sdk/v20231115012/admin"
package admin // import "go.mongodb.org/atlas-sdk/v20231115013/admin"

import (
"errors"
Expand All @@ -8,7 +8,7 @@ import (
"strings"

"github.com/mongodb-forks/digest"
"go.mongodb.org/atlas-sdk/v20231115012/internal/core"
"go.mongodb.org/atlas-sdk/v20231115013/internal/core"
)

const (
Expand Down
148 changes: 148 additions & 0 deletions admin/model_paginated_connected_org_configs.go
@@ -0,0 +1,148 @@
// Code based on the AtlasAPI V2 OpenAPI file

package admin

import (
"encoding/json"
)

// PaginatedConnectedOrgConfigs struct for PaginatedConnectedOrgConfigs
type PaginatedConnectedOrgConfigs struct {
// List of one or more Uniform Resource Locators (URLs) that point to API sub-resources, related API resources, or both. RFC 5988 outlines these relationships.
// Read only field.
Links *[]Link `json:"links,omitempty"`
// List of returned documents that MongoDB Cloud providers when completing this request.
// Read only field.
Results *[]ConnectedOrgConfig `json:"results,omitempty"`
// Total number of documents available. MongoDB Cloud omits this value if `includeCount` is set to `false`.
// Read only field.
TotalCount *int `json:"totalCount,omitempty"`
}

// NewPaginatedConnectedOrgConfigs instantiates a new PaginatedConnectedOrgConfigs object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewPaginatedConnectedOrgConfigs() *PaginatedConnectedOrgConfigs {
this := PaginatedConnectedOrgConfigs{}
return &this
}

// NewPaginatedConnectedOrgConfigsWithDefaults instantiates a new PaginatedConnectedOrgConfigs object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewPaginatedConnectedOrgConfigsWithDefaults() *PaginatedConnectedOrgConfigs {
this := PaginatedConnectedOrgConfigs{}
return &this
}

// GetLinks returns the Links field value if set, zero value otherwise
func (o *PaginatedConnectedOrgConfigs) GetLinks() []Link {
if o == nil || IsNil(o.Links) {
var ret []Link
return ret
}
return *o.Links
}

// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PaginatedConnectedOrgConfigs) GetLinksOk() (*[]Link, bool) {
if o == nil || IsNil(o.Links) {
return nil, false
}

return o.Links, true
}

// HasLinks returns a boolean if a field has been set.
func (o *PaginatedConnectedOrgConfigs) HasLinks() bool {
if o != nil && !IsNil(o.Links) {
return true
}

return false
}

// SetLinks gets a reference to the given []Link and assigns it to the Links field.
func (o *PaginatedConnectedOrgConfigs) SetLinks(v []Link) {
o.Links = &v
}

// GetResults returns the Results field value if set, zero value otherwise
func (o *PaginatedConnectedOrgConfigs) GetResults() []ConnectedOrgConfig {
if o == nil || IsNil(o.Results) {
var ret []ConnectedOrgConfig
return ret
}
return *o.Results
}

// GetResultsOk returns a tuple with the Results field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PaginatedConnectedOrgConfigs) GetResultsOk() (*[]ConnectedOrgConfig, bool) {
if o == nil || IsNil(o.Results) {
return nil, false
}

return o.Results, true
}

// HasResults returns a boolean if a field has been set.
func (o *PaginatedConnectedOrgConfigs) HasResults() bool {
if o != nil && !IsNil(o.Results) {
return true
}

return false
}

// SetResults gets a reference to the given []ConnectedOrgConfig and assigns it to the Results field.
func (o *PaginatedConnectedOrgConfigs) SetResults(v []ConnectedOrgConfig) {
o.Results = &v
}

// GetTotalCount returns the TotalCount field value if set, zero value otherwise
func (o *PaginatedConnectedOrgConfigs) GetTotalCount() int {
if o == nil || IsNil(o.TotalCount) {
var ret int
return ret
}
return *o.TotalCount
}

// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *PaginatedConnectedOrgConfigs) GetTotalCountOk() (*int, bool) {
if o == nil || IsNil(o.TotalCount) {
return nil, false
}

return o.TotalCount, true
}

// HasTotalCount returns a boolean if a field has been set.
func (o *PaginatedConnectedOrgConfigs) HasTotalCount() bool {
if o != nil && !IsNil(o.TotalCount) {
return true
}

return false
}

// SetTotalCount gets a reference to the given int and assigns it to the TotalCount field.
func (o *PaginatedConnectedOrgConfigs) SetTotalCount(v int) {
o.TotalCount = &v
}

func (o PaginatedConnectedOrgConfigs) MarshalJSONWithoutReadOnly() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o PaginatedConnectedOrgConfigs) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
return toSerialize, nil
}
2 changes: 1 addition & 1 deletion auth/device_flow.go
Expand Up @@ -22,7 +22,7 @@ import (
"strings"
"time"

core "go.mongodb.org/atlas-sdk/v20231115012/internal/core"
core "go.mongodb.org/atlas-sdk/v20231115013/internal/core"
)

const authExpiredError = "DEVICE_AUTHORIZATION_EXPIRED"
Expand Down
2 changes: 1 addition & 1 deletion auth/oauth.go
Expand Up @@ -26,7 +26,7 @@ import (
"runtime"
"strings"

"go.mongodb.org/atlas-sdk/v20231115012/internal/core"
"go.mongodb.org/atlas-sdk/v20231115013/internal/core"
)

const defaultBaseURL = "https://cloud.mongodb.com/"
Expand Down
2 changes: 1 addition & 1 deletion auth/oauth_test.go
Expand Up @@ -24,7 +24,7 @@ import (
"reflect"
"testing"

core "go.mongodb.org/atlas-sdk/v20231115012/internal/core"
core "go.mongodb.org/atlas-sdk/v20231115013/internal/core"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions docs/doc_2_error_handling.md
Expand Up @@ -9,7 +9,7 @@ Errors are represented by [ApiErrorObject](https://github.com/mongodb/atlas-sdk-
To fetch the error object, execute the following:

```go
import "go.mongodb.org/atlas-sdk/v20231115012/admin"
import "go.mongodb.org/atlas-sdk/v20231115013/admin"

projects, response, err := admin.ProjectsApi.ListProjects(ctx).Execute()
apiError, ok := admin.AsError(err)
Expand All @@ -21,7 +21,7 @@ fmt.Println(apiError)
To check for the existence of a specific error code (e.g. `MAXIMUM_INDEXES_FOR_TENANT_EXCEEDED`), execute the following:

```go
import admin "go.mongodb.org/atlas-sdk/v20231115012/admin"
import admin "go.mongodb.org/atlas-sdk/v20231115013/admin"

projects, response, err := admin.ProjectsApi.ListProjects(ctx).Execute()
if admin.IsErrorCode(err, "code"){
Expand All @@ -34,7 +34,7 @@ if admin.IsErrorCode(err, "code"){
To check for the existence of a specific HTTP response error code, execute the following:

```go
import admin "go.mongodb.org/atlas-sdk/v20231115012/admin"
import admin "go.mongodb.org/atlas-sdk/v20231115013/admin"

projects, response, err := admin.ProjectsApi.ListProjects(ctx).Execute()
apiError, ok := admin.AsError(err)
Expand Down
2 changes: 1 addition & 1 deletion docs/doc_3_migration.md
Expand Up @@ -18,7 +18,7 @@ The Atlas Go SDK doesn't rely on the deprecated [go-client-mongodb-atlas](https:
The Atlas Go SDK has different methods for the initialization of the clients:

```go
import admin "go.mongodb.org/atlas-sdk/v20231115012/admin"
import admin "go.mongodb.org/atlas-sdk/v20231115013/admin"
sdk, err := admin.NewClient(
// Authentication using ApiKey and ApiSecret
admin.UseDigestAuth(apiKey, apiSecret))
Expand Down
2 changes: 1 addition & 1 deletion docs/doc_4_authentication.md
Expand Up @@ -11,7 +11,7 @@ Construct a new Atlas SDK client, then use the services on the client to
access different parts of the Atlas Admin API. For example:

```go
import "go.mongodb.org/atlas-sdk/v20231115012/admin"
import "go.mongodb.org/atlas-sdk/v20231115013/admin"

func example() {
ctx := context.Background()
Expand Down
1 change: 1 addition & 0 deletions docs/doc_last_reference.md
Expand Up @@ -608,6 +608,7 @@ Class | Method | HTTP request | Description | [SDK Maturity](ht
- [PaginatedCloudBackupRestoreJob](./docs/PaginatedCloudBackupRestoreJob.md)
- [PaginatedCloudBackupShardedClusterSnapshot](./docs/PaginatedCloudBackupShardedClusterSnapshot.md)
- [PaginatedCloudProviderContainer](./docs/PaginatedCloudProviderContainer.md)
- [PaginatedConnectedOrgConfigs](./docs/PaginatedConnectedOrgConfigs.md)
- [PaginatedContainerPeer](./docs/PaginatedContainerPeer.md)
- [PaginatedDatabase](./docs/PaginatedDatabase.md)
- [PaginatedDiskPartition](./docs/PaginatedDiskPartition.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/AWSClustersDNSApi.md
Expand Up @@ -26,7 +26,7 @@ import (
"fmt"
"os"

"go.mongodb.org/atlas-sdk/v20231115012/admin"
"go.mongodb.org/atlas-sdk/v20231115013/admin"
)

func main() {
Expand Down Expand Up @@ -99,7 +99,7 @@ import (
"fmt"
"os"

"go.mongodb.org/atlas-sdk/v20231115012/admin"
"go.mongodb.org/atlas-sdk/v20231115013/admin"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/AccessTrackingApi.md
Expand Up @@ -26,7 +26,7 @@ import (
"fmt"
"os"

"go.mongodb.org/atlas-sdk/v20231115012/admin"
"go.mongodb.org/atlas-sdk/v20231115013/admin"
)

func main() {
Expand Down Expand Up @@ -112,7 +112,7 @@ import (
"fmt"
"os"

"go.mongodb.org/atlas-sdk/v20231115012/admin"
"go.mongodb.org/atlas-sdk/v20231115013/admin"
)

func main() {
Expand Down

0 comments on commit 30e92c7

Please sign in to comment.