secretsmanager

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 7 Imported by: 0

README

awsutils/secretsmanager

The secretsmanager package is a collection of utility functions designed to simplify common secretsmanager tasks.


Table of contents


Functions

CreateConnection()
CreateConnection() Connection

CreateConnection creates a connection with Secrets Manager and returns it.


CreateOrUpdateSecret(*secretsmanager.SecretsManager, string, string, string)
CreateOrUpdateSecret(*secretsmanager.SecretsManager string string string) error

CreateOrUpdateSecret creates a new secret or updates an existing one.


CreateSecret(*secretsmanager.SecretsManager, string, string, string)
CreateSecret(*secretsmanager.SecretsManager, string, string, string) error

CreateSecret creates an input secretName with the specified secretValue.


DeleteSecret(*secretsmanager.SecretsManager, string, bool)
DeleteSecret(*secretsmanager.SecretsManager, string, bool) error

DeleteSecret deletes an input secretName. It will attempt to do so forcefully if forceDelete is set to true.


GetSecret(*secretsmanager.SecretsManager, string)
GetSecret(*secretsmanager.SecretsManager, string) string, error

GetSecret returns the value of an input secretName.


ReplicateSecret(Connection, string, string, []string)
ReplicateSecret(Connection, string, string, []string) error

ReplicateSecret replicates a secret with the specified secretName to multiple target regions.


UpdateSecret(*secretsmanager.SecretsManager, string, string)
UpdateSecret(*secretsmanager.SecretsManager, string, string) error

UpdateSecret updates an existing secret


Installation

To use the awsutils/secretsmanager package, you first need to install it. Follow the steps below to install via go get.

go get github.com/l50/awsutils/secretsmanager

Usage

After installation, you can import the package in your Go project using the following import statement:

import "github.com/l50/awsutils/secretsmanager"

Tests

To ensure the package is working correctly, run the following command to execute the tests for awsutils/secretsmanager:

go test -v

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.


License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateSecret

func CreateOrUpdateSecret(client *secretsmanager.SecretsManager, secretName string, secretDesc string, secretValue string) error

CreateOrUpdateSecret creates a new secret or updates an existing one.

func CreateSecret

func CreateSecret(client *secretsmanager.SecretsManager,
	secretName string, secretDesc string, secretValue string) error

CreateSecret creates an input `secretName` with the specified `secretValue`.

func DeleteSecret

func DeleteSecret(client *secretsmanager.SecretsManager, secretName string, forceDelete bool) error

DeleteSecret deletes an input `secretName`. It will attempt to do so forcefully if `forceDelete` is set to true.

func GetSecret

func GetSecret(client *secretsmanager.SecretsManager, secretName string) (string, error)

GetSecret returns the value of an input `secretName`.

func ReplicateSecret

func ReplicateSecret(connection Connection, secretName string, newSecretName string, targetRegions []string) error

ReplicateSecret replicates a secret with the specified `secretName` to multiple target regions.

func UpdateSecret

func UpdateSecret(client *secretsmanager.SecretsManager, secretName string, secretValue string) error

UpdateSecret updates an existing secret

Types

type Connection

type Connection struct {
	Client  *secretsmanager.SecretsManager
	Session *session.Session
	Params  Params
}

Connection contains all of the relevant information to maintain a Secrets Manager connection.

func CreateConnection

func CreateConnection() Connection

CreateConnection creates a connection with Secrets Manager and returns it.

type Params

type Params struct {
	Name        string
	Description string
	Value       string
	Created     time.Time
	Modified    time.Time
}

Params provides parameter options for Secrets Manager.

Jump to

Keyboard shortcuts

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