Skip to content

Commit

Permalink
(DOCSP-30264) Copy edits the static docs files (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahsimpers authored Jun 1, 2023
1 parent f376c57 commit fbba857
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 52 deletions.
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Atlas SDK GO documentation
# Atlas Go SDK Documentation

* [Concepts used in Atlas SDK GO](./doc_1_concepts.md#concepts-used-in-atlas-sdk-go)
* [Learn Concepts for the Atlas Go SDK](./doc_1_concepts.md#concepts-used-in-atlas-sdk-go)
* [Introduction](./doc_1_concepts.md#introduction)
* [Fetching Data from the Backend](./doc_1_concepts.md#fetching-data-from-the-backend)
* [Performing Data Modification](./doc_1_concepts.md#performing-data-modification)
Expand All @@ -14,7 +14,7 @@
* [Fetching Error Object](./doc_2_error_handling.md#fetching-error-object)
* [Checking for existence of specific error code](./doc_2_error_handling.md#checking-for-existence-of-specific-error-code)

* [Migration Guide](./doc_3_migration.md#migration-guide)
* [Migrate from the Go HTTP Client to the Atlas Go SDK](./doc_3_migration.md#migration-guide)
* [Summary](./doc_3_migration.md#summary)
* [Background](./doc_3_migration.md#background)
* [Structural changes](./doc_3_migration.md#structural-changes)
Expand Down
22 changes: 11 additions & 11 deletions docs/doc_1_concepts.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Concepts used in Atlas SDK GO
# Learn Concepts for the Atlas Go SDK

## Introduction

For each API SDK provides number of methods that users can call to fetch or modify data on the backend.
SDK offers flexibility in how various arguments can be passed to the client.
You can use the Atlas Go SDK to fetch or modify data from the Atlas Admin API.
The Atlas Go SDK is flexible because it accepts many different types of arguments.

## Fetching Data from the Backend
## Fetching Data from the Back End

To fetch data execute `{Api}.{Operation}WithParams()` method:
To fetch data, you can execute the `{Api}.{Operation}WithParams()` method:

```go
// 1. Calling API method
Expand All @@ -19,27 +19,27 @@ To fetch data execute `{Api}.{Operation}WithParams()` method:
PageNum: admin.PtrInt(1),
})

// 3. Values in requests can be also supplied using individual methods
// 3. You can also supply values in requests using individual methods
// This can be helpful when passing request objects to other methods.
projects, response, err := request.ItemsPerPage(10).Execute()
examples.HandleErr(err, response)
```

Alternatively you can use shorter `{Operation}()` method using builder pattern to supply all arguments:
Alternatively, you can use the shorter `{Operation}()` method with a builder pattern to supply all arguments:

```go
projects, response, err := sdk.ProjectsApi.ListProjects(ctx).
ItemsPerPage(1).Execute()
```

Note: Path parameters are always required and they will be supplied directly in the `{Operation}()` method:
Note: The Atlas Go SDK requires path parameters and they must be provided directly in the `{Operation}()` method.

Note: SDK supplies default values for both query and post objects.
Note: The Atlas Go SDK supplies default values for both query and post objects.


## Performing Data Modification

Use `{Operation}()` method to perform modifications. For example:
Use the `{Operation}()` method to perform modifications. For example:


```go
Expand All @@ -49,4 +49,4 @@ Note: SDK supplies default values for both query and post objects.

## Example

For more information about usage please refer to the [basic example](../examples/)
To learn more about using the SDK, see the [basic example](../examples/)
12 changes: 9 additions & 3 deletions docs/doc_2_error_handling.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

# Error Handling

SDK enables users to obtain detailed information about errors returned from backend.
You can obtain detailed information about errors returned by the API when you use the Atlas Go SDK. Use the error code to determine the cause of the error. To learn more about API error codes, see [Atlas Administration API Error Codes](https://www.mongodb.com/docs/atlas/reference/api-errors/).

Errors are represented by [ErrorObject](./admin/model_error.go).
Users should rely on the error code for detection of specific error cases.

## Fetching Error Object

To fetch the error object, execute the following:

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

Expand All @@ -14,7 +17,10 @@ apiError := admin.AsError(err)
fmt.Println(apiError)
```

## Checking for existence of specific error code
## Checking for the Existence of a Specific Error Code

To check for the existence of a specific error code, execute the following:

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

Expand Down
54 changes: 22 additions & 32 deletions docs/doc_3_migration.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# Migration Guide
# Migrate from the Go HTTP Client to the Atlas Go SDK

This document is meant to help you migrate from [go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas) to [mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go).
Use this guide to migrate from the Go HTTP client ([go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas)) to the Atlas Go SDK ([mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go)).

## Summary

End users can migrate from [mongodb/go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas) to [mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go) partially
by using both librarires at the same time.

An [go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas) will no longer receive major feature updates.
We strongly recommend updating to [mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go) for the latest changes.
The [go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas) is deprecated and doesn't receive major feature updates. We strongly recommend migrating to the [Atlas Go SDK](https://github.com/mongodb/atlas-sdk-go) for the latest changes. You can also migrate partially by using both libraries at the same time.

## Background

[mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go) is based on Atlas V2 API.
Atlas-sdk-go hides a complexity related to Versioned API by exposing versioned API as golang methods.
End users need to be aware that major sdk releases can introduce breaking changes only in the small subset of the Atlas APIs.
The Atlas Go SDK ([mongodb/atlas-sdk-go](https://github.com/mongodb/atlas-sdk-go)) is based on the Atlas Admin API V2.
The Atlas Go SDK simplifies the complexity of the versioned API by exposing the versioned API as Golang methods. Major SDK releases can introduce breaking changes only in a small subset of the Atlas Admin API endpoints.

## Structural changes
## Structural Changes

SDK have been rewriten completely from scratch.
Our team made attempts to minimize amount of changes required for the end users.
brings a number of changes in how API requests are made.
The Atlas Go SDK doesn't rely on the deprecated [go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas). It changes how API requests are made, but minimizes the changes required for the end users.

### Client Initialization

New SDK has different methods for the initialization of the clients.
The Atlas Go SDK has different methods for the initialization of the clients:

```go
import admin "go.mongodb.org/atlas-sdk/admin"
Expand All @@ -33,45 +24,44 @@ sdk, err := admin.NewClient(
admin.UseDigestAuth(apiKey, apiSecret))
```

Note: Both SDKs use Digest based authentication. The same credentials will apply.
Note: Both the deprecated [go-client-mongodb-atlas](https://github.com/mongodb/go-client-mongodb-atlas) and the Atlas Go SDK use Digest-based authentication. The same credentials apply.

Please follow [authentication guide](https://github.com/mongodb/atlas-sdk-go#authentication) for more information.
To learn more, see [Authenticate using the Atlas Go SDK](https://github.com/mongodb/atlas-sdk-go#authentication).

### Error handling
### Error Handling

Error handling requires developers to use dedicated methods for casting errors to APIError objects.
Error handling requires developers to use dedicated methods for casting errors to API error objects:

```go
apiErr, _ := admin.AsError(err)
log.Fatalf("Error when performing SDK request: %v", apiErr.GetDetail())
```
Please follow [error handling guide](https://github.com/mongodb/atlas-sdk-go#error-handling) for more information.
To learn more, see [Error Handling](https://github.com/mongodb/atlas-sdk-go#error-handling).

### Format of the API interface
### Format of the API Interface

API interface has changed to differentiate APIs from other methods in the SDK.
Each API method has an Api suffix. For example:
The Atlas Go SDK changes the API interface to differentiate APIs from other methods.

Each API method has an API suffix. For example:

`sdk.Projects` will now `sdk.ProjectsApi`

Each method now explains the object that is created. For example:

`sdk.Projects.create()` will become `sdk.ProjectsApi.createProject(...)`

Please refer to the [endpoint documentation](https://github.com/mongodb/go-client-mongodb-atlas/tree/main/mongodbatlasv2#documentation-for-api-endpoints) for more information.
To learn more, see the [Endpoint Documentation](https://github.com/mongodb/go-client-mongodb-atlas/tree/main/mongodbatlasv2#documentation-for-api-endpoints).

### Different naming conventions for SDK methods
### Different Naming Conventions for SDK Methods

Model names and properties are formatted in PascalCase format for clarity and predictability of the methods and field names.
For example, _ClusterAWSProviderSettings_ will become now _ClusterAwsProviderSettings_.

The same applies to property names:

For example, `ID` fields will become `Id` etc.
The same applies to property names. For example, `ID` fields will become `Id` etc.

### Multiple choices when creating request body objects
### Multiple Choices when Creating Request Body Objects

New SDK improves clarity for request and response objects. For situations when the endpoint accepts multiple formats of the payload (polymorphism), users are able to specify instances of the Api models they want to use for a particular request. For example, when creating a cluster we can use one of the dedicated RegionConfigs objects (AWSRegionConfig, GCPRegionConfig, etc.):
The Atlas Go SDK improves the clarity for request and response objects. For situations when the endpoint accepts multiple formats of the payload (polymorphism), you can specify instances of the API models that you want to use for a particular request. For example, when creating a cluster you can use one of the dedicated RegionConfigs objects (AWSRegionConfig, GCPRegionConfig, etc.):


```go
Expand Down
6 changes: 3 additions & 3 deletions docs/doc_4_authentication.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Authentication
# Authenticate using the Atlas Go SDK

The `atlas-sdk-go` library uses Digest authentication.
To obtain authentication tokens users can use Atlas UI or Atlas CLI
You can [create an API key](https://www.mongodb.com/docs/atlas/configure-api-access/#create-an-api-key-in-an-organization) through the Atlas UI or the Atlas CLI.

For more information please follow: https://www.mongodb.com/docs/atlas/api/api-authentication
To learn more about API authentication, see [Atlas Administration API Authentication](https://www.mongodb.com/docs/atlas/api/api-authentication).

0 comments on commit fbba857

Please sign in to comment.