options

package
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright 2023 MongoDB Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	MongodHostnamePrefix = "mongod"
	MongotHostnamePrefix = "mongot"
	CheckHostnamePrefix  = "check"

	MongotDockerImageName = "docker.io/mongodb/mongodb-atlas-search:preview"
	PausedState           = "PAUSED"
	StoppedState          = "STOPPED"
	IdleState             = "IDLE"
	DeletingState         = "DELETING"
	RestartingState       = "RESTARTING"
	LocalCluster          = "local"
	AtlasCluster          = "atlas"
	CompassConnect        = "compass"
	MongoshConnect        = "mongosh"
	PromptTypeMessage     = "What type of deployment would you like to work with?"
	MaxItemsPerPage       = 500
)
View Source
const (
	ConnectWithConnectionString = "connectionString"
	ConnectWithMongosh          = "mongosh"
	ConnectWithCompass          = "compass"
)

Variables

View Source
var (
	ErrNotAuthenticated    = errors.New("you are not authenticated. Please, run atlas auth login")
	ErrCompassNotInstalled = errors.New("did not find MongoDB Compass, install: https://dochub.mongodb.org/core/install-compass")
	ErrMongoshNotInstalled = errors.New("did not find mongosh, install: https://dochub.mongodb.org/core/install-mongosh")
	DeploymentTypeOptions  = []string{LocalCluster, AtlasCluster}
)
View Source
var (
	ErrInvalidConnectWith = errors.New("invalid --connectWith option")
	ConnectWithOptions    = []string{ConnectWithMongosh, ConnectWithCompass, ConnectWithConnectionString}
)
View Source
var (
	ConnectionStringTypeStandard = "standard"
)
View Source
var ErrDeploymentNotFound = errors.New("deployment not found")

Functions

func LocalDeploymentName

func LocalDeploymentName(hostname string) string

func ValidateConnectWith

func ValidateConnectWith(s string) error

func ValidateDeploymentName

func ValidateDeploymentName(n string) error

Types

type ConnectOpts

type ConnectOpts struct {
	cli.OutputOpts
	DeploymentOpts
	ConnectWith string
	ConnectToAtlasOpts
}

func (*ConnectOpts) Connect

func (opts *ConnectOpts) Connect(ctx context.Context) error

type ConnectToAtlasOpts

type ConnectToAtlasOpts struct {
	cli.GlobalOpts
	cli.InputOpts
	ConnectionStringType string
	Store                store.AtlasClusterDescriber
}

func (*ConnectToAtlasOpts) InitAtlasStore

func (opts *ConnectToAtlasOpts) InitAtlasStore(ctx context.Context) func() error

type Deployment

type Deployment struct {
	Type           string
	Name           string
	MongoDBVersion string
	StateName      string
}

type DeploymentOpts

type DeploymentOpts struct {
	DeploymentName string
	DeploymentType string
	MdbVersion     string
	Port           int
	DBUsername     string
	DBUserPassword string
	PodmanClient   podman.Client
	CredStore      store.CredentialsGetter

	DefaultSetter         cli.DefaultSetterOpts
	AtlasClusterListStore store.ClusterLister
	Config                setup.ProfileReader
	// contains filtered or unexported fields
}

func (*DeploymentOpts) AtlasDeployments

func (opts *DeploymentOpts) AtlasDeployments(projectID string) ([]Deployment, error)

func (*DeploymentOpts) CheckIfDeploymentExists

func (opts *DeploymentOpts) CheckIfDeploymentExists(ctx context.Context) error

func (*DeploymentOpts) ConnectionString

func (opts *DeploymentOpts) ConnectionString(ctx context.Context) (string, error)

func (*DeploymentOpts) DetectLocalDeploymentName

func (opts *DeploymentOpts) DetectLocalDeploymentName(ctx context.Context) error

func (*DeploymentOpts) GetLocalDeployments

func (opts *DeploymentOpts) GetLocalDeployments(ctx context.Context) ([]Deployment, error)

func (*DeploymentOpts) InitStore

func (opts *DeploymentOpts) InitStore(ctx context.Context, writer io.Writer) func() error

func (*DeploymentOpts) InternalMongotAddress

func (*DeploymentOpts) InternalMongotAddress(ip string) string

func (*DeploymentOpts) IsAtlasDeploymentType

func (opts *DeploymentOpts) IsAtlasDeploymentType() bool

func (*DeploymentOpts) IsAuthEnabled

func (opts *DeploymentOpts) IsAuthEnabled() bool

func (*DeploymentOpts) IsCliAuthenticated

func (opts *DeploymentOpts) IsCliAuthenticated() bool

func (*DeploymentOpts) IsLocalDeploymentType

func (opts *DeploymentOpts) IsLocalDeploymentType() bool

func (*DeploymentOpts) LocalCheckHostname

func (opts *DeploymentOpts) LocalCheckHostname() string

func (*DeploymentOpts) LocalDeploymentPreRun

func (opts *DeploymentOpts) LocalDeploymentPreRun(ctx context.Context) error

func (*DeploymentOpts) LocalMongoMetricsVolume

func (opts *DeploymentOpts) LocalMongoMetricsVolume() string

func (*DeploymentOpts) LocalMongodDataVolume

func (opts *DeploymentOpts) LocalMongodDataVolume() string

func (*DeploymentOpts) LocalMongodHostname

func (opts *DeploymentOpts) LocalMongodHostname() string

func (*DeploymentOpts) LocalMongotDataVolume

func (opts *DeploymentOpts) LocalMongotDataVolume() string

func (*DeploymentOpts) LocalMongotHostname

func (opts *DeploymentOpts) LocalMongotHostname() string

func (*DeploymentOpts) LocalNetworkName

func (opts *DeploymentOpts) LocalNetworkName() string

func (*DeploymentOpts) MongodDockerImageName

func (opts *DeploymentOpts) MongodDockerImageName() string

func (*DeploymentOpts) MongotIP

func (opts *DeploymentOpts) MongotIP(ctx context.Context) (string, error)

func (*DeploymentOpts) NoDeploymentTypeSet

func (opts *DeploymentOpts) NoDeploymentTypeSet() bool

func (*DeploymentOpts) PostRunMessages

func (opts *DeploymentOpts) PostRunMessages() error

func (*DeploymentOpts) PromptConnectWith

func (opts *DeploymentOpts) PromptConnectWith() (string, error)

func (*DeploymentOpts) RemoveLocal

func (opts *DeploymentOpts) RemoveLocal(ctx context.Context) error

func (*DeploymentOpts) Select

func (opts *DeploymentOpts) Select(deployments []Deployment) (Deployment, error)

func (*DeploymentOpts) SelectDeployments

func (opts *DeploymentOpts) SelectDeployments(ctx context.Context, projectID string) (Deployment, error)

func (*DeploymentOpts) SelectLocal

func (opts *DeploymentOpts) SelectLocal(ctx context.Context) error

func (*DeploymentOpts) StartSpinner

func (opts *DeploymentOpts) StartSpinner()

func (*DeploymentOpts) StopSpinner

func (opts *DeploymentOpts) StopSpinner()

func (*DeploymentOpts) ValidateAndPromptDeploymentType

func (opts *DeploymentOpts) ValidateAndPromptDeploymentType() error

func (*DeploymentOpts) WaitForMongot

func (opts *DeploymentOpts) WaitForMongot(parentCtx context.Context, ip string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL