config

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Copyright 2023 The Cloud-Barista Authors.

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

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.2.1

func Init()

init

func NewDynamoDBClient

func NewDynamoDBClient(accesskey, secretkey, region string) (*dynamodb.Client, error)

func NewDynamoDBClientWithEndpoint

func NewDynamoDBClientWithEndpoint(accesskey, secretkey, region string, endpoint string) (*dynamodb.Client, error)

func NewFireStoreClient

func NewFireStoreClient(credentialsJson, projectID, databaseID string) (*firestore.Client, error)

func NewFireStoreClientWithDatabase

func NewFireStoreClientWithDatabase(credentialsFile, projectID, databaseID string) (*firestore.Client, error)

func NewGCPClient

func NewGCPClient(credentialsJson string) (*storage.Client, error)

func NewNCPMongoDBClient

func NewNCPMongoDBClient(username, password, host string, port int) (*mongo.Client, error)

func NewS3Client

func NewS3Client(accesskey, secretkey, region string) (*s3.Client, error)

func NewS3ClientWithEndpoint

func NewS3ClientWithEndpoint(accesskey, secretkey, region string, endpoint string) (*s3.Client, error)

Types

type ConfigManager added in v0.2.1

type ConfigManager struct {
	DefaultProfile string
	ProfileManager ProfileManager
	// contains filtered or unexported fields
}

ConfigManager structure definition

func NewConfigManager added in v0.2.1

func NewConfigManager(configPath string) (*ConfigManager, error)

NewConfigManager loads the config from the specified path

func (*ConfigManager) CreateConfig added in v0.2.1

func (cm *ConfigManager) CreateConfig(configData map[string]interface{}) error

CreateConfig creates a new config.json file with the given data

func (*ConfigManager) DeleteConfig added in v0.2.1

func (cm *ConfigManager) DeleteConfig() error

DeleteConfig deletes the config.json file

func (*ConfigManager) GetDefaultCredentials added in v0.2.1

func (cm *ConfigManager) GetDefaultCredentials(provider string) (interface{}, error)

GetDefaultCredentials returns the default profile credentials

func (*ConfigManager) ReadConfig added in v0.2.1

func (cm *ConfigManager) ReadConfig() (map[string]interface{}, error)

ReadConfig reads the config.json file and returns the data

func (*ConfigManager) UpdateConfig added in v0.2.1

func (cm *ConfigManager) UpdateConfig(updatedData map[string]interface{}) error

UpdateConfig updates the config.json file with the given data

type FileProfileManager added in v0.2.1

type FileProfileManager struct {
	// contains filtered or unexported fields
}

func NewProfileManager added in v0.2.1

func NewProfileManager(profileFilePath ...string) *FileProfileManager

func NewProfileManagerDefault added in v0.2.1

func NewProfileManagerDefault() *FileProfileManager

func (*FileProfileManager) CreateProfile added in v0.2.1

func (fpm *FileProfileManager) CreateProfile(profileName string, credentials models.ProfileCredentials) error

C profile by name

func (*FileProfileManager) DeleteProfile added in v0.2.1

func (fpm *FileProfileManager) DeleteProfile(profileName string) error

D profile by name

func (*FileProfileManager) LoadAllProfiles added in v0.2.1

func (fpm *FileProfileManager) LoadAllProfiles() (map[string]models.ProfileCredentials, error)

R profiles

func (*FileProfileManager) LoadCredentialsByProfile added in v0.2.1

func (fpm *FileProfileManager) LoadCredentialsByProfile(profileName string, provider string) (interface{}, error)

R profile by name

func (*FileProfileManager) SaveAllProfiles added in v0.2.1

func (fpm *FileProfileManager) SaveAllProfiles(profiles map[string]models.ProfileCredentials) error

Save File with profiles

func (*FileProfileManager) UpdateProfile added in v0.2.1

func (fpm *FileProfileManager) UpdateProfile(profileName string, credentials models.ProfileCredentials) error

U profile by name

func (*FileProfileManager) ValidateProfiles added in v0.2.1

func (fpm *FileProfileManager) ValidateProfiles() error

ValidateProfiles checks that at least one profile exists, each profile has at least one credential, and that all provided credentials have non-empty required fields.

type InitConfig added in v0.2.1

type InitConfig struct {
	Profile ProfileConfig `mapstructure:"profile"`
	Logger  LogConfig     `mapstructure:"log"`
}
var Settings InitConfig

type LogConfig added in v0.2.1

type LogConfig struct {
	ZeroConfig `mapstructure:",squash"`
	File       LumberConfig `mapstructure:",squash"`
}

type LumberConfig added in v0.2.1

type LumberConfig struct {
	Path       string `mapstructure:"filepath"`
	MaxSize    int    `mapstructure:"maxsize"`
	MaxBackups int    `mapstructure:"maxbackups"`
	MaxAge     int    `mapstructure:"maxage"`
	Compress   bool   `mapstructure:"compress"`
}

type ProfileConfig added in v0.2.1

type ProfileConfig struct {
	Default string `mapstructure:"default"`
}

type ProfileManager added in v0.2.1

type ProfileManager interface {
	LoadAllProfiles() (map[string]models.ProfileCredentials, error)
	SaveAllProfiles(profiles map[string]models.ProfileCredentials) error
	CreateProfile(profileName string, credentials models.ProfileCredentials) error
	UpdateProfile(profileName string, credentials models.ProfileCredentials) error
	DeleteProfile(profileName string) error
	LoadCredentialsByProfile(profileName string, provider string) (interface{}, error)
}

type ZeroConfig added in v0.2.1

type ZeroConfig struct {
	LogLevel  string `mapstructure:"level"`
	LogWriter string `mapstructure:"writer"`
}

Jump to

Keyboard shortcuts

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