Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: remove all references to go.mongodb.org/atlas-sdk/v20231115007 #2753

Merged
merged 2 commits into from Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion build/ci/library_owners.json
Expand Up @@ -26,7 +26,6 @@
"github.com/stretchr/testify": "mongocli",
"github.com/tangzero/inflector": "mongocli",
"go.mongodb.org/atlas": "mongocli",
"go.mongodb.org/atlas-sdk/v20231115007": "mongocli",
"go.mongodb.org/mongo-driver": "mongocli",
"go.mongodb.org/ops-manager": "mongocli",
"golang.org/x/crypto": "mongocli",
Expand Down
1 change: 0 additions & 1 deletion go.mod
Expand Up @@ -28,7 +28,6 @@ require (
github.com/stretchr/testify v1.9.0
github.com/tangzero/inflector v1.0.0
go.mongodb.org/atlas v0.36.0
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0
go.mongodb.org/mongo-driver v1.14.0
go.mongodb.org/ops-manager v0.55.3
golang.org/x/crypto v0.21.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Expand Up @@ -210,8 +210,6 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/atlas v0.36.0 h1:m05S3AO7zkl+bcG1qaNsEKBnAqnKx2FDwLooHpIG3j4=
go.mongodb.org/atlas v0.36.0/go.mod h1:nfPldE9dSama6G2IbIzmEza02Ly7yFZjMMVscaM0uEc=
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0 h1:gvUBkSoeNtM9FSBQy8rh6cm6qXn4yXbQGzK09X0eAdk=
go.mongodb.org/atlas-sdk/v20231115007 v20231115007.0.0/go.mod h1:JU7JOUGcv7pfDzbRTwIr8hGy2R1lehdrdfGj9fDjSVY=
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
go.mongodb.org/ops-manager v0.55.3 h1:ZckNLra9XfvUxWgRfdCVOr7QkeCPi7S4VNbcK5di/2A=
Expand Down
28 changes: 4 additions & 24 deletions internal/watchers/watcher.go
Expand Up @@ -19,8 +19,7 @@ import (
"fmt"
"time"

atlasv2 "go.mongodb.org/atlas-sdk/v20231115007/admin"
atlas "go.mongodb.org/atlas/mongodbatlas"
"go.mongodb.org/ops-manager/opsmngr"
)

type InvalidStateError struct {
Expand Down Expand Up @@ -69,20 +68,6 @@ type Watcher struct {
defaultWait time.Duration
}

const defaultWait = 4 * time.Second

func NewWatcher(stateTransition StateTransition, describer StateDescriber) *Watcher {
return NewWatcherWithDefaultWait(stateTransition, describer, defaultWait)
}

func NewWatcherWithDefaultWait(stateTransition StateTransition, describer StateDescriber, defaultWait time.Duration) *Watcher {
return &Watcher{
stateTransition: stateTransition,
describer: describer,
defaultWait: defaultWait,
}
}

func (watcher *Watcher) Watch() error {
watcher.hasStarted = false
if watcher.NonConstantBackoff {
Expand Down Expand Up @@ -184,8 +169,8 @@ func (st *StateTransition) IsEndError(err error) bool {
return false
}

var atlasErr *atlas.ErrorResponse
var atlasv2Err *atlasv2.GenericOpenAPIError
var atlasErr *opsmngr.ErrorResponse

var errCode string

if st.EndErrorCode == nil {
Expand All @@ -195,8 +180,6 @@ func (st *StateTransition) IsEndError(err error) bool {
switch {
case errors.As(err, &atlasErr):
errCode = atlasErr.ErrorCode
case errors.As(err, &atlasv2Err):
errCode = *atlasv2Err.Model().ErrorCode
default:
return false
}
Expand All @@ -209,15 +192,12 @@ func (st *StateTransition) HasEndError() bool {
}

func (st *StateTransition) IsRetryableError(err error) bool {
var atlasErr *atlas.ErrorResponse
var atlasv2Err *atlasv2.GenericOpenAPIError
var atlasErr *opsmngr.ErrorResponse
var errCode string

switch {
case errors.As(err, &atlasErr):
errCode = atlasErr.ErrorCode
case errors.As(err, &atlasv2Err):
errCode = *atlasv2Err.Model().ErrorCode
default:
return false
}
Expand Down