secretmanager

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

README

GCP Secret Manager storage

Usage

package mypkg

import (
	"context"
	"fmt"
	"github.com/viant/afs"
	"github.com/viant/afs/file"
	_ "github.com/viant/afsc/gcp"
	"log"
	"strings"
)

func Example_DownloadWithURL() {
	fs := afs.New()
	URL := "gcp://secretmanager/projects/gcp-e2e/secrets/test2sec"
	err := fs.Upload(context.TODO(), URL, file.DefaultFileOsMode, strings.NewReader("test is super secret"))
	if err != nil {
		log.Fatalf("err: %v\n", err)
	}
	data, err := fs.DownloadWithURL(context.TODO(), URL)
	if err != nil {
		log.Fatalf("err: %v\n", err)
	}
	fmt.Printf("%s %v\n", data, err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStorager

func NewStorager(ctx context.Context, baseURL string, options ...storage.Option) (*storager, error)

NewStorager create a new secreate manager storager

Types

type Resource

type Resource struct {
	ProjectID string
	Secret    string
	Version   string
}

Resource represent secret resource

func (*Resource) Name

func (r *Resource) Name() string

Name returns resource name

func (*Resource) VersionedName

func (r *Resource) VersionedName() string

VersionedName return versioned name

Jump to

Keyboard shortcuts

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