doppler

package module
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 15 Imported by: 0

README

 

doppler-go

A Go client for the Doppler API.

 

codecov Go Report Card Codacy Badge Maintainability go.dev reference

 

About

doppler-go is a Go client for the Doppler API. It provides a simple and easy to use interface for interacting with the Doppler API.

The base design is heavily inspired by the Stripe Go client, yet there are still some distinct differences.

Stability

This project is currently in an early stage of development. I have not yet confirmed the functionality of all endpoints through extensive end-to-end testing. Therefore, I cannot guarantee for any stability or correctness.

I plan to support this project for the foreseeable future. However, I cannot guarantee that I will be able to fix bugs or add new features in a timely manner.

If you find any bugs or have any suggestions, please open an issue or a pull request.

Features

  • Doppler REST API v3:
    • Audit
    • Auth
    • Configs
    • Config Logs
    • Dynamic Secrets
    • Environments
    • Projects
    • Secrets
    • Service Tokens
    • Token Sharing
    • Workplaces

Install

go get -u github.com/kperreau/doppler-go

Example usage

package main

import (
  "context"
  "fmt"
  "log"

  "github.com/kperreau/doppler-go"
  "github.com/kperreau/doppler-go/secret"
)

func main() {
  // Set your API key
  doppler.Key = "YOUR_API_KEY"

  // List all your secrets
  secrets, err := secret.List(context.Background(), &doppler.SecretListOptions{
    Project: "YOUR_PROJECT",
    Config:  "YOUR_CONFIG",
  })
  if err != nil {
    log.Fatalf("failed to list secrets: %v", err)
  }

  for name, value := range secrets {
    fmt.Printf("%s: %v\n", name, value)
  }
}

Contributing

Contributions of all kinds are very welcome! Feel free to check our open issues. Please also take a look at the contribution guidelines.

Show your support

Please give a ⭐️ if you like this project! This helps us to get more visibility and helps other people to find this project.

Documentation

Overview

Package doppler provides a Go client library for the Doppler REST API.

Website: https://www.doppler.com/ Docs: https://docs.doppler.com/docs API Reference: https://docs.doppler.com/reference/api Auth Token Formats: https://docs.doppler.com/reference/auth-token-formats

Example:

    package main

    import (
        "github.com/kperreau/doppler-go"
	    "github.com/kperreau/doppler-go/project"
    )

		func main() {
			ctx := context.Background()

			// Set your API key
			doppler.Key = "YOUR_API_KEY"

			// Get a list of all projects
			projects, _,  err := project.List(ctx, nil)
			if err != nil {
				panic(err)
			}

			// Print the names of all projects and update them afterwards
			for _, project := range projects {
				fmt.Println(project.Name)
			}

			// Update the first project
			_, _, err = project.Update(ctx, &doppler.ProjectUpdateOptions{
				Name: projects[0].Name,
				NewConfig:        ...,              // Leaving this out, so nobody accidentally overwrites a real project
				NewDescription:   ...,
			})
			if err != nil {
				panic(err)
			}
		}

Index

Constants

View Source
const (
	// SDKVersion is the version of the SDK
	SDKVersion = "0.2.1"

	// APIURL is the base URL for the API
	APIURL string = "https://api.doppler.com"

	// UnknownPlatform is the platform name for unknown platforms
	UnknownPlatform = "unknown platform"
)
View Source
const (
	// EncryptionKDF is the key derivation function used for encrypted secrets. As stated in the docs [1] this
	// has to be "pbkdf2". This is a constatnt to avoid typos and help with testing.
	//
	// [1]: https://docs.doppler.com/reference/share-secret-encrypted
	EncryptionKDF = "pbkdf2"

	// EncryptionSaltRounds is the number of salt rounds used by the key derivation function. As stated in the docs [1] this
	// has to be "100000". This is a constatnt to avoid typos and help with testing.
	//
	// [1]: https://docs.doppler.com/reference/share-secret-encrypted
	EncryptionSaltRounds = 100000
)

Variables

Key is the API key used to authenticate with the API

Functions

func SetAppInfo

func SetAppInfo(info *AppInfo)

SetAppInfo sets the information about the "app" which this integration belongs to.

Types

type APIResponse

type APIResponse struct {
	// Header is the HTTP response header of the response.
	Header http.Header `json:"header,omitempty"`

	// RequestID is the ID of the request. It can be used to identify the request in the logs; useful for debugging.
	RequestID string `json:"request_id,omitempty"`

	// RateLimit is the ratelimit information returned by the API.
	RateLimit *RateLimit `json:"ratelimit,omitempty"`

	// Status is the HTTP status code of the response, e.g. 200 OK
	Status string `json:"status,omitempty"`

	// StatusCode is the HTTP status code of the response, e.g. 200
	StatusCode int `json:"status_code,omitempty"`

	// Success is true if the request was successful. This gets set by Doppler.
	Success *bool `json:"success,omitempty"`

	// Messages is a list of potential messages from the Doppler API.
	Messages []string `json:"messages,omitempty"`

	// Page is the current page of results.
	Page *int `json:"page,omitempty"`
}

APIResponse is the base response type for all Doppler API responses.

func (*APIResponse) Error

func (r *APIResponse) Error() error

Error checks if the APIResponse contains any errors. If so, it returns an error containing all messages.

func (*APIResponse) WithDetails

func (r *APIResponse) WithDetails(resp *http.Response)

WithDetails binds important details from the HTTP response to the APIResponse.

type ActivityLog

type ActivityLog struct {
	ID          *string `json:"id,omitempty"`          // ID is the unique identifier for the activity log.
	Text        *string `json:"text,omitempty"`        // Text describing the event.
	HTML        *string `json:"html,omitempty"`        // HTML describing the event.
	User        *User   `json:"user,omitempty"`        // User is the user that triggered the event.
	Project     *string `json:"project,omitempty"`     // Project is the project that triggered the event.
	Environment *string `json:"environment,omitempty"` // Environment is the environment's unique identifier.
	Config      *string `json:"config,omitempty"`      // Config is the config's name.
	CreatedAt   *string `json:"created_at,omitempty"`  // CreatedAt is the time the activity log was created.
}

ActivityLog represents a doppler activity log.

type ActivityLogGetOptions

type ActivityLogGetOptions struct {
	ID string `url:"log" json:"-"` // ID is the unique identifier for the log object.
}

ActivityLogGetOptions represents the query parameters for an activity log get request.

type ActivityLogGetResponse

type ActivityLogGetResponse struct {
	APIResponse `json:",inline"`
	ActivityLog *ActivityLog `json:"log"`
}

ActivityLogGetResponse represents a response from the activity log endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/logs Docs: https://docs.doppler.com/reference/activity-log-retrieve

type ActivityLogListOptions

type ActivityLogListOptions struct {
	ListOptions `url:",inline" json:"-"`
}

ActivityLogListOptions represents the query parameters for an activity log list request.

type ActivityLogListResponse

type ActivityLogListResponse struct {
	APIResponse  `json:",inline"`
	ActivityLogs []*ActivityLog `json:"logs"`
}

ActivityLogListResponse represents a response from the activity log list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/logs Docs: https://docs.doppler.com/reference/activity-logs-list ActivityLogsListResponse represents a response from the activity logs list endpoint.

type AppInfo

type AppInfo struct {
	Name    string `json:"name"`
	URL     string `json:"url"`
	Version string `json:"version"`
}

AppInfo contains information about the "app" which this integration belongs to.

type AuditWorkplace

type AuditWorkplace struct {
	ID           *string `json:"id,omitempty"`            // The ID of the workplace
	Name         *string `json:"name,omitempty"`          // The name of the workplace
	BillingEmail *string `json:"billing_email,omitempty"` // The billing email of the workplace
	SAMLEnabled  *bool   `json:"saml_enabled,omitempty"`  // Whether SAML is enabled for the workplace
	SCIMEnabled  *bool   `json:"scim_enabled,omitempty"`  // Whether SCIM is enabled for the workplace
}

AuditWorkplace represents an audit entry for a workplace

type AuditWorkplaceGetOptions

type AuditWorkplaceGetOptions struct {
	Settings *bool `url:"settings,omitempty" json:"-"` // If true, the api will return more information if the workplace has e.g. SAML enabled and SCIM enabled.
}

AuditWorkplaceGetOptions represents options for the audit workplace get endpoint.

type AuditWorkplaceGetResponse

type AuditWorkplaceGetResponse struct {
	APIResponse    `json:",inline"`
	AuditWorkplace *AuditWorkplace `json:"workplace,omitempty"`
}

AuditWorkplaceGetResponse represents a response from the audit workplace get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/workplace Docs: https://docs.doppler.com/reference/audit-workplace-retrieve

type AuditWorkplaceUser

type AuditWorkplaceUser struct {
	ID        *string `json:"id,omitempty"`         // The ID of the user
	Access    *string `json:"access,omitempty"`     // The access level of the user
	User      *User   `json:"user,omitempty"`       // The user
	CreatedAt *string `json:"created_at,omitempty"` // The time the user was added to the workplace
}

AuditWorkplaceUser represents an audit entry for a workplace user

type AuditWorkplaceUserGetOptions

type AuditWorkplaceUserGetOptions struct {
	UserID   string `url:"-" json:"-"`
	Settings *bool  `url:"settings,omitempty" json:"-"` // If true, the api will return more information if the workplace has e.g. SAML enabled and SCIM enabled.
}

AuditWorkplaceUserGetOptions represents options for the audit workplace user get endpoint.

type AuditWorkplaceUserGetResponse

type AuditWorkplaceUserGetResponse struct {
	APIResponse        `json:",inline"`
	AuditWorkplaceUser *AuditWorkplaceUser `json:"workplace_user,omitempty"`
}

AuditWorkplaceUserGetResponse represents a response from the audit workplace user get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/workplace/users/{workplace_user_id} Docs: https://docs.doppler.com/reference/audit-workplace-user-retrieve

type AuditWorkplaceUserListOptions

type AuditWorkplaceUserListOptions struct {
	Settings *bool `url:"settings,omitempty" json:"-"` // If true, the api will return more information if the workplace has e.g. SAML enabled and SCIM enabled.
}

AuditWorkplaceUserListOptions represents options for the audit workplace user list endpoint.

type AuditWorkplaceUserListResponse

type AuditWorkplaceUserListResponse struct {
	APIResponse         `json:",inline"`
	AuditWorkplaceUsers []*AuditWorkplaceUser `json:"workplace_users,omitempty"`
}

AuditWorkplaceUserListResponse represents a response from the audit workplace user list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/workplace/users Docs: https://docs.doppler.com/reference/audit-workplace-users-retrieve

type Auth

type Auth struct{}

Auth is the object representing an auth.

type AuthRevokeOptions

type AuthRevokeOptions struct {
	Tokens []AuthToken `url:"-" json:"tokens"` // A list of tokens to revoke.
}

AuthRevokeOptions revokes an auth token.

func (*AuthRevokeOptions) MarshalJSON

func (opts *AuthRevokeOptions) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller for AuthRevokeOptions. The API expects the Tokens slice directly, instead of wrapped in a Tokens object. To not break the API and compatibility with this library, we need to do this custom marshalling.

type AuthRevokeResponse

type AuthRevokeResponse struct {
	APIResponse `json:",inline"`
}

AuthRevokeResponse is the response from the AuthRevokeOptions endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/auth/revoke Docs: https://docs.doppler.com/reference/auth-revoke

type AuthToken

type AuthToken struct {
	Token *string `url:"-" json:"token,omitempty"` // The token itself.
}

AuthToken is the object representing an auth token.

type Backend

type Backend interface {
	Call(ctx context.Context, req *Request, resp Response) error
	CallRaw(ctx context.Context, req *Request) (*http.Response, error)
}

Backend is the backend used by the SDK. It is used to make requests to the API.

func GetBackend

func GetBackend() Backend

GetBackend returns a new backend with the default configuration.

func GetBackendWithConfig

func GetBackendWithConfig(config *BackendConfig) Backend

GetBackendWithConfig returns a new backend with the given configuration. This is the preferred way to create a new backend.

type BackendConfig

type BackendConfig struct {
	// Client is the HTTP client to use for requests. If nil, a default client will be used.
	Client *http.Client

	// URL is the base URL for the API. If empty, the default URL will be used.
	URL *string

	// Logger is the logger to use for logging. If nil, a noop logger will be used.
	Logger logging.Logger
}

BackendConfig is the configuration for the backend.

type Config

type Config struct {
	Name           *string `json:"name,omitempty"`             // Name of the configuration.
	Project        *string `json:"project,omitempty"`          // Identifier of the project that the config belongs to.
	Environment    *string `json:"environment,omitempty"`      // Identifier of the environment that the config belongs to.
	Root           *bool   `json:"root,omitempty"`             // Whether the config is the root of the environment.
	Locked         *bool   `json:"locked,omitempty"`           // Whether the config can be renamed and/or deleted.
	InitialFetchAt *string `json:"initial_fetch_at,omitempty"` // Date and time of the first secrets fetch.
	LastFetchAt    *string `json:"last_fetch_at,omitempty"`    // Date and time of the last secrets fetch.
	CreatedAt      *string `json:"created_at,omitempty"`       // Date and time of the object's creation.
}

Config represents a Doppler configuration.

type ConfigCloneOptions

type ConfigCloneOptions struct {
	Project   string `url:"-" json:"project"` // Identifier of the project that the config belongs to.
	Config    string `url:"-" json:"config"`  // Name of the config.
	NewConfig string `url:"-" json:"name"`    // Name of the new config.
}

ConfigCloneOptions represents the body parameters for a config clone request.

type ConfigCloneResponse

type ConfigCloneResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config"`
}

ConfigCloneResponse represents a response from the config clone endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/clone Docs: https://docs.doppler.com/reference/config-clone

type ConfigCreateOptions

type ConfigCreateOptions struct {
	Project     string `url:"-" json:"project"`     // Identifier of the project that the config belongs to.
	Environment string `url:"-" json:"environment"` // Identifier of the environment that the config belongs to.
	Name        string `url:"-" json:"name"`        // Name of the new branch configuration.
}

ConfigCreateOptions represents the body parameters for a config create request.

type ConfigCreateResponse

type ConfigCreateResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config"`
}

ConfigCreateResponse represents a response from the config create endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs Docs: https://docs.doppler.com/reference/config-create

type ConfigDeleteOptions

type ConfigDeleteOptions struct {
	Project string `url:"-" json:"project"` // Identifier of the project that the config belongs to.
	Config  string `url:"-" json:"config"`  // Name of the config.
}

ConfigDeleteOptions represents the body parameters for a config delete request.

type ConfigDeleteResponse

type ConfigDeleteResponse struct {
	APIResponse `json:",inline"`
}

ConfigDeleteResponse represents a response from the config delete endpoint.

Method: DELETE Endpoint: https://api.doppler.com/v3/configs/config Docs: https://docs.doppler.com/reference/config-delete

type ConfigGetOptions

type ConfigGetOptions struct {
	Project string `url:"project" json:"-"` // Identifier of the project that the config belongs to.
	Config  string `url:"config" json:"-"`  // Name of the config.
}

ConfigGetOptions represents the options for the config get endpoint.

type ConfigGetResponse

type ConfigGetResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config,omitempty"`
}

ConfigGetResponse represents a response from the config get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config Docs: https://docs.doppler.com/reference/config-retrieve

type ConfigListOptions

type ConfigListOptions struct {
	ListOptions `url:",inline" json:"-"`
	Project     string `url:"project" json:"-"` // Identifier of the project that the config belongs to.
}

ConfigListOptions represents the query parameters for a config list request.

type ConfigListResponse

type ConfigListResponse struct {
	APIResponse `json:",inline"`
	Configs     []*Config `json:"configs"`
}

ConfigListResponse represents a response from the config list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs Docs: https://docs.doppler.com/reference/config-list

type ConfigLockOptions

type ConfigLockOptions struct {
	Project string `url:"-" json:"project"` // Identifier of the project that the config belongs to.
	Config  string `url:"-" json:"config"`  // Name of the config.
}

ConfigLockOptions represents the body parameters for a config lock request.

type ConfigLockResponse

type ConfigLockResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config"`
}

ConfigLockResponse represents a response from the config lock endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/lock Docs: https://docs.doppler.com/reference/config-lock

type ConfigLog

type ConfigLog struct {
	ID          *string         `json:"id,omitempty"`          // Unique identifier of the config log.
	Text        *string         `json:"text,omitempty"`        // Text describing the event.
	HTML        *string         `json:"html,omitempty"`        // HTML describing the event.
	Diff        []ConfigLogDiff `json:"diff,omitempty"`        // Diff between the previous and current config.
	Rollback    *bool           `json:"rollback,omitempty"`    // Is this config log a rollback of a previous log.
	User        *User           `json:"user,omitempty"`        // User that triggered the event.
	Project     *string         `json:"project,omitempty"`     // Identifier of the project that the config belongs to.
	Environment *string         `json:"environment,omitempty"` // Identifier of the environment that the config belongs to.
	Config      *string         `json:"config,omitempty"`      // Name of the config.
	CreatedAt   *string         `json:"created_at,omitempty"`  // Date and time of the object's creation.
}

ConfigLog represents a Doppler config log.

type ConfigLogDiff

type ConfigLogDiff struct {
	Name  *string `json:"name,omitempty"`  // Name of the config.
	Added *string `json:"added,omitempty"` // Added data.
}

ConfigLogDiff represents a diff between two config logs.

type ConfigLogGetOptions

type ConfigLogGetOptions struct {
	Project string `url:"project" json:"-"` // Identifier of the project that the config belongs to.
	Config  string `url:"config" json:"-"`  // Name of the config.
	ID      string `url:"log" json:"-"`     // Unique identifier of the config log.
}

ConfigLogGetOptions represents the options for the config log get endpoint.

type ConfigLogGetResponse

type ConfigLogGetResponse struct {
	APIResponse `json:",inline"`
	ConfigLog   *ConfigLog `json:"config_log,omitempty"`
}

ConfigLogGetResponse represents a response from the config log get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/logs/log Docs: https://docs.doppler.com/reference/config-log-retrieve

type ConfigLogListOptions

type ConfigLogListOptions struct {
	ListOptions `url:",inline" json:"-"`
	Project     string `url:"project" json:"-"` // Identifier of the project that the config belongs to.
	Config      string `url:"config" json:"-"`  // Name of the config.
}

ConfigLogListOptions represents the query parameters for a config log list request.

type ConfigLogListResponse

type ConfigLogListResponse struct {
	APIResponse `json:",inline"`
	ConfigLogs  []*ConfigLog `json:"logs"`
}

ConfigLogListResponse represents a response from the config log list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/logs Docs: https://docs.doppler.com/reference/config-log-list

type ConfigLogRollbackOptions

type ConfigLogRollbackOptions struct {
	Project string `url:"project" json:"-"` // Identifier of the project that the config belongs to.
	Config  string `url:"config" json:"-"`  // Name of the config.
	ID      string `url:"log" json:"-"`     // Unique identifier of the config log.
}

ConfigLogRollbackOptions represents the options for the config log rollback endpoint.

type ConfigLogRollbackResponse

type ConfigLogRollbackResponse struct {
	APIResponse `json:",inline"`
	ConfigLog   *ConfigLog `json:"config_log,omitempty"`
}

ConfigLogRollbackResponse represents a response from the config log rollback endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/logs/log/rollback Docs: https://docs.doppler.com/reference/config-log-rollback

type ConfigUnlockOptions

type ConfigUnlockOptions struct {
	Project string `url:"-" json:"project"` // Identifier of the project that the config belongs to.
	Config  string `url:"-" json:"config"`  // Name of the config.
}

ConfigUnlockOptions represents the body parameters for a config unlock request.

type ConfigUnlockResponse

type ConfigUnlockResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config"`
}

ConfigUnlockResponse represents a response from the config unlock endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/unlock Docs: https://docs.doppler.com/reference/config-unlock

type ConfigUpdateOptions

type ConfigUpdateOptions struct {
	Project string `url:"-" json:"project"` // Identifier of the project that the config belongs to.
	Config  string `url:"-" json:"config"`  // Name of the config.
	NewName string `url:"-" json:"name"`    // New name of the config.
}

ConfigUpdateOptions represents the body parameters for a config update request.

type ConfigUpdateResponse

type ConfigUpdateResponse struct {
	APIResponse `json:",inline"`
	Config      *Config `json:"config"`
}

ConfigUpdateResponse represents a doppler config update request.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config Docs: https://docs.doppler.com/reference/config-update

type DynamicSecretIssueLeaseOptions

type DynamicSecretIssueLeaseOptions struct {
	Project    string `url:"-" json:"project"`        // The project where the dynamic secret is located
	Config     string `url:"-" json:"config"`         // The config where the dynamic secret is located
	Name       string `url:"-" json:"dynamic_secret"` // The dynamic secret to issue a lease for
	TTLSeconds int32  `url:"-" json:"ttl_seconds"`    // The number of seconds the lease should last
}

DynamicSecretIssueLeaseOptions represents the options for the dynamic secret issue lease endpoint.

type DynamicSecretIssueLeaseResponse

type DynamicSecretIssueLeaseResponse struct {
	APIResponse `json:",inline"`
}

DynamicSecretIssueLeaseResponse represents a response from the dynamic secret issue lease endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/dynamic_secrets/dynamic_secret/leases Docs: https://docs.doppler.com/reference/dynamic-secret-issue-lease

type DynamicSecretRevokeLeaseOptions

type DynamicSecretRevokeLeaseOptions struct {
	Project string `url:"-" json:"project"`        // The project where the dynamic secret is located
	Config  string `url:"-" json:"config"`         // The config where the dynamic secret is located
	Name    string `url:"-" json:"dynamic_secret"` // The dynamic secret to revoke a lease for
	Slug    string `url:"-" json:"slug"`           // The lease to revoke
}

DynamicSecretRevokeLeaseOptions represents the options for the dynamic secret revoke lease endpoint.

type DynamicSecretRevokeLeaseResponse

type DynamicSecretRevokeLeaseResponse struct {
	APIResponse `json:",inline"`
}

DynamicSecretRevokeLeaseResponse represents a response from the dynamic secret revoke lease endpoint.

Method: DELETE Endpoint: https://api.doppler.com/v3/configs/config/dynamic_secrets/dynamic_secret/leases/lease Docs: https://docs.doppler.com/reference/dynamic-secret-issue-revoke-lease

type Environment

type Environment struct {
	ID             *string `json:"id,omitempty"`               // An identifier for the object.
	Slug           *string `json:"slug,omitempty"`             // A unique identifier for the environment.
	Name           *string `json:"name,omitempty"`             // Name of the environment.
	Project        *string `json:"project,omitempty"`          // Identifier of the project the environment belongs to.
	InitialFetchAt *string `json:"initial_fetch_at,omitempty"` // Date and time of the first secrets fetch from a config in the environment.
	CreatedAt      *string `json:"created_at,omitempty"`       // Date and time of the object's creation.
}

Environment represents a doppler environment.

type EnvironmentCreateOptions

type EnvironmentCreateOptions struct {
	Project string `url:"project" json:"-"`        // Identifier of the project the environment belongs to.
	Name    string `url:"-" json:"name,omitempty"` // Name of the environment.
	Slug    string `url:"-" json:"slug,omitempty"` // A unique identifier for the environment.
}

EnvironmentCreateOptions represents the body parameters for a environment create request.

type EnvironmentCreateResponse

type EnvironmentCreateResponse struct {
	APIResponse `json:",inline"`
	Environment *Environment `json:"environment"`
}

EnvironmentCreateResponse represents a response from the environment create endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/environments Docs: https://docs.doppler.com/reference/environment-create

type EnvironmentDeleteOptions

type EnvironmentDeleteOptions struct {
	Project string `url:"project" json:"-"`     // Identifier of the project the environment belongs to.
	Slug    string `url:"environment" json:"-"` // A unique identifier for the environment.
}

EnvironmentDeleteOptions represents the body parameters for a environment delete request.

type EnvironmentDeleteResponse

type EnvironmentDeleteResponse struct {
	APIResponse `json:",inline"`
}

EnvironmentDeleteResponse represents a response from the environment delete endpoint.

Method: DELETE Endpoint: https://api.doppler.com/v3/environments/environment Docs: https://docs.doppler.com/reference/environment-delete

type EnvironmentGetOptions

type EnvironmentGetOptions struct {
	Project string `url:"project" json:"-"`     // Identifier of the project the environment belongs to.
	Slug    string `url:"environment" json:"-"` // A unique identifier for the environment.
}

EnvironmentGetOptions represents the options for the environment get endpoint.

type EnvironmentGetResponse

type EnvironmentGetResponse struct {
	APIResponse `json:",inline"`
	Environment *Environment `json:"environment,omitempty"`
}

EnvironmentGetResponse represents a response from the environment get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/environments/environment Docs: https://docs.doppler.com/reference/environment-retrieve

type EnvironmentListOptions

type EnvironmentListOptions struct {
	Project string `url:"project" json:"-"` // Identifier of the project the environment belongs to.
}

EnvironmentListOptions represents the query parameters for a environment list request.

type EnvironmentListResponse

type EnvironmentListResponse struct {
	APIResponse  `json:",inline"`
	Environments []*Environment `json:"environments"`
}

EnvironmentListResponse represents a response from the environment list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/environments Docs: https://docs.doppler.com/reference/environment-list

type EnvironmentRenameOptions

type EnvironmentRenameOptions struct {
	Project string  `url:"project" json:"-"`        // Identifier of the project the environment belongs to.
	Slug    string  `url:"environment" json:"-"`    // A unique identifier for the environment.
	NewName *string `url:"-" json:"name,omitempty"` // New name of the environment.
	NewSlug *string `url:"-" json:"slug,omitempty"` // New slug of the environment.
}

EnvironmentRenameOptions represents the body parameters for a environment rename request.

type EnvironmentRenameResponse

type EnvironmentRenameResponse struct {
	APIResponse `json:",inline"`
	Environment *Environment `json:"environment"`
}

EnvironmentRenameResponse represents a doppler environment rename request.

Method: POST Endpoint: https://api.doppler.com/v3/environments/environment Docs: https://docs.doppler.com/reference/environment-rename

type ListOptions

type ListOptions struct {
	Page    int `url:"page,omitempty"`
	PerPage int `url:"per_page,omitempty"`
}

ListOptions is the base struct for all list options. It contains the common parameters used across all list endpoints. It's meant to be embedded in more specific list options structs.

type Project

type Project struct {
	ID          *string `json:"id,omitempty"`          // ID is the unique identifier for the object.
	Name        *string `json:"name,omitempty"`        // Name is the name of the project.
	Slug        *string `json:"slug,omitempty"`        // Slug is an abbreviated name for the project.
	Description *string `json:"description,omitempty"` // Description is the description of the project.
	CreatedAt   *string `json:"created_at,omitempty"`  // CreatedAt is the time the project was created.
}

Project represents a doppler project.

type ProjectCreateOptions

type ProjectCreateOptions struct {
	Name        string  `url:"-" json:"name"`                  // Name of the project.
	Description *string `url:"-" json:"description,omitempty"` // Description of the project.
}

ProjectCreateOptions represents the body parameters for a project create request.

type ProjectCreateResponse

type ProjectCreateResponse struct {
	APIResponse `json:",inline"`
	Project     *Project `json:"project"`
}

ProjectCreateResponse represents a response from the project create endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/projects Docs: https://docs.doppler.com/reference/project-create

type ProjectDeleteOptions

type ProjectDeleteOptions struct {
	Name string `url:"-" json:"project"` // Name of the project.
}

ProjectDeleteOptions represents the body parameters for a project delete request.

type ProjectDeleteResponse

type ProjectDeleteResponse struct {
	APIResponse `json:",inline"`
}

ProjectDeleteResponse represents a response from the project delete endpoint.

Method: DELETE Endpoint: https://api.doppler.com/v3/projects/project Docs: https://docs.doppler.com/reference/project-delete

type ProjectGetOptions

type ProjectGetOptions struct {
	Name string `url:"project" json:"-"` // Name is the name of the project.
}

ProjectGetOptions represents the options for the project get endpoint.

type ProjectGetResponse

type ProjectGetResponse struct {
	APIResponse `json:",inline"`
	Project     *Project `json:"project,omitempty"`
}

ProjectGetResponse represents a response from the project get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/projects/project Docs: https://docs.doppler.com/reference/project-retrieve

type ProjectListOptions

type ProjectListOptions struct {
	ListOptions `url:",inline" json:"-"`
}

ProjectListOptions represents the query parameters for a project list request.

type ProjectListResponse

type ProjectListResponse struct {
	APIResponse `json:",inline"`
	Projects    []*Project `json:"projects"`
}

ProjectListResponse represents a response from the project list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/projects Docs: https://docs.doppler.com/reference/project-list

type ProjectUpdateOptions

type ProjectUpdateOptions struct {
	Name           string  `url:"-" json:"project"`               // Name of the project.
	NewName        string  `url:"-" json:"name,omitempty"`        // New name of the project.
	NewDescription *string `url:"-" json:"description,omitempty"` // New description of the project.
}

ProjectUpdateOptions represents the body parameters for a project update request.

type ProjectUpdateResponse

type ProjectUpdateResponse struct {
	APIResponse `json:",inline"`
	Project     *Project `json:"project"`
}

ProjectUpdateResponse represents a doppler project update request.

Method: POST Endpoint: https://api.doppler.com/v3/projects/project Docs: https://docs.doppler.com/reference/project-update

type RateLimit

type RateLimit struct {
	// Limit is the maximum number of requests allowed per period.
	Limit int `json:"limit"`

	// Remaining is the number of requests remaining in the current period.
	Remaining int `json:"remaining"`

	// Reset is the time when the current period ends.
	Reset time.Time `json:"reset"`
}

RateLimit is the ratelimit information returned by the API.

type Request

type Request struct {
	// Header are the headers to send with the request.
	Header http.Header `json:"-"`

	// Method is the HTTP method to use. e.g. "GET"
	Method string `json:"method"`

	// Path is the path to the API endpoint. e.g. "/projects"
	Path string `json:"path"`

	// Key is the API key to use.
	Key string `json:"-"`

	// Payload is expected to be a struct holding all necessary query and body parameters. Every field in the struct
	// is expected to be clearly tagged with the corresponding API parameter name and either "url" or "json", not both.
	// The "url" tag is used for query parameters, the "json" tag is used for body parameters.
	//
	// Example:
	//  type ExamplePayload struct {
	//  	// Query parameter
	//  	ProjectID string `url:"project_id" json:"-"`
	//
	//  	// Body parameter
	//  	ProjectName string `url:"-" json:"project_name"`
	//  }
	//
	//  As you can see, we have to be explicit about which parameters are query and which are body parameters. One of
	//  the parameter types ("url" or "json") must be set to "-". If this is not the case, the request may potentially
	//  be malformed and fail. However, we do not check for this, since there may be cases where you want to send a
	//  parameter in both the query and the body.
	//
	//  The above example will result in a request with the following query parameters:
	//      ?project_id=123
	//
	//  And the following body:
	//      { "project_name": "my project" }
	//
	Payload any `json:"payload,omitempty"`
}

Request is the base request type all Backend calls. Internally, it is converted to an HTTP request and sent to the API.

type Response

type Response interface {
	WithDetails(resp *http.Response)
	Error() error
}

Response is the base response type all Backend calls. It's meant to bind the response body and parts of the HTTP response, hence the required WithDetails method.

type Secret

type Secret struct {
	Name  string      `json:"name,omitempty"`  // The name of the secret.
	Value SecretValue `json:"value,omitempty"` // The value of the secret.
}

Secret represents a single Doppler secret, including its name and value.

type SecretDownloadOptions

type SecretDownloadOptions struct {
	Project           string  `url:"project" json:"-"`                           // The name of the project containing the secret.
	Config            string  `url:"config" json:"-"`                            // The name of the config containing the secret.
	IncludeManaged    *bool   `url:"include_managed_secrets,omitempty" json:"-"` // Whether to include managed secrets.
	IncludeDynamic    *bool   `url:"include_dynamic_secrets,omitempty" json:"-"` // Whether to include dynamic secrets.
	DynamicTTLSeconds *int32  `url:"dynamic_secrets_ttl_sec,omitempty" json:"-"` // The number of seconds until dynamic leases expire. Must be used with include_dynamic_secrets.
	Format            *string `url:"format,omitempty" json:"-"`                  // The format to download the secrets in. See official docs for supported formats.
	NameTransformer   *string `url:"name_transformer,omitempty" json:"-"`        // The name transformer to use when downloading the secrets. See official docs for supported transformers.
}

SecretDownloadOptions represents options for the secrets download endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/secrets/download Docs: https://docs.doppler.com/reference/config-secret-download

type SecretGetOptions

type SecretGetOptions struct {
	Project string `url:"project" json:"-"` // The name of the project containing the secret.
	Config  string `url:"config" json:"-"`  // The name of the config containing the secret.
	Name    string `url:"name" json:"-"`    // The name of the secret.
}

SecretGetOptions represents options for the secrets get endpoint.

type SecretGetResponse

type SecretGetResponse struct {
	APIResponse `json:",inline"`
	Secret      `json:",inline"`
}

SecretGetResponse represents a response from the secrets get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/secret Docs: https://docs.doppler.com/reference/config-secret-retrieve

type SecretListOptions

type SecretListOptions struct {
	Project           string  `url:"project" json:"-"`                           // The name of the project containing the secret.
	Config            string  `url:"config" json:"-"`                            // The name of the config containing the secret.
	IncludeManaged    *bool   `url:"include_managed_secrets,omitempty" json:"-"` // Whether to include managed secrets.
	IncludeDynamic    *bool   `url:"include_dynamic_secrets,omitempty" json:"-"` // Whether to include dynamic secrets.
	DynamicTTLSeconds *int32  `url:"dynamic_secrets_ttl_sec,omitempty" json:"-"` // The number of seconds until dynamic leases expire. Must be used with include_dynamic_secrets.
	Secrets           *string `url:"secrets,omitempty" json:"-"`                 // A comma-separated list of secret names to include.
}

SecretListOptions represents options for the secrets list endpoint.

type SecretListResponse

type SecretListResponse struct {
	APIResponse `json:",inline"`
	Secrets     map[string]*SecretValue `json:"secrets"`
}

SecretListResponse represents a response from the secrets list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/secrets Docs: https://docs.doppler.com/reference/config-secret-list

type SecretUpdateOptions

type SecretUpdateOptions struct {
	Project    string            `url:"-" json:"project"` // The name of the project containing the secret.
	Config     string            `url:"-" json:"config"`  // The name of the config containing the secret.
	NewSecrets map[string]string `url:"-" json:"secrets"` // The secrets to update.
}

SecretUpdateOptions represents options for the secrets update endpoint.

type SecretUpdateResponse

type SecretUpdateResponse struct {
	APIResponse `json:",inline"`
	Secrets     map[string]string `json:"secrets"`
}

SecretUpdateResponse represents a response from the secrets update endpoint.

Method: PUT Endpoint: https://api.doppler.com/v3/configs/config/secrets Docs: https://docs.doppler.com/reference/config-secret-update

type SecretValue

type SecretValue struct {
	Raw      string `json:"raw,omitempty"`      // The raw value of the secret.
	Computed string `json:"computed,omitempty"` // The computed value of the secret.
}

SecretValue represents a single Doppler secret value.

type ServiceToken

type ServiceToken struct {
	Name        *string `json:"name,omitempty"`        // Name of the service token.
	Slug        *string `json:"slug,omitempty"`        // A unique identifier of the service token.
	Key         *string `json:"key,omitempty"`         // An API key that is used for authentication. Only available when creating the token.
	Project     *string `json:"project,omitempty"`     // Unique identifier for the project object.
	Environment *string `json:"environment,omitempty"` // Unique identifier for the environment object.
	Config      *string `json:"config,omitempty"`      // The config's name.
	Access      *string `json:"access,omitempty"`      // The access level of the service token. One of read, read/write.
	ExpiresAt   *string `json:"expires_at,omitempty"`  // Date and time of the token's expiration, or null if token does not auto-expire.
	CreatedAt   *string `json:"created_at,omitempty"`  // Date and time of the object's creation.
}

ServiceToken represents a Doppler service token.

type ServiceTokenCreateOptions

type ServiceTokenCreateOptions struct {
	Project   string  `url:"-" json:"project,omitempty"`    // Unique identifier for the project object.
	Config    string  `url:"-" json:"config,omitempty"`     // The config's name.
	Name      string  `url:"-" json:"name,omitempty"`       // Name of the service token.
	Access    *string `url:"-" json:"access,omitempty"`     // The access level of the service token. One of read, read/write.
	ExpiresAt *string `url:"-" json:"expires_at,omitempty"` // Date and time of the token's expiration, or null if token does not auto-expire.
}

ServiceTokenCreateOptions represents the options for the service-token create endpoint.

type ServiceTokenCreateResponse

type ServiceTokenCreateResponse struct {
	APIResponse `json:",inline"`
	Token       *ServiceToken `json:"token,omitempty"`
}

ServiceTokenCreateResponse represents a response from the service-token create endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/configs/config/tokens Docs: https://docs.doppler.com/reference/config-token-create

type ServiceTokenDeleteOptions

type ServiceTokenDeleteOptions struct {
	Project string `url:"-" json:"project,omitempty"` // Unique identifier for the project object.
	Config  string `url:"-" json:"config,omitempty"`  // The config's name.
	Slug    string `url:"-" json:"slug,omitempty"`    // A unique identifier of the service token.
}

ServiceTokenDeleteOptions represents the options for the service-token delete endpoint.

type ServiceTokenDeleteResponse

type ServiceTokenDeleteResponse struct {
	APIResponse `json:",inline"`
}

ServiceTokenDeleteResponse represents a response from the service-token delete endpoint.

Method: DELETE Endpoint: https://api.doppler.com/v3/configs/config/tokens/token Docs: https://docs.doppler.com/reference/config-token-delete

type ServiceTokenListOptions

type ServiceTokenListOptions struct {
	Project string `url:"project,omitempty" json:"-"` // Unique identifier for the project object.
	Config  string `url:"config,omitempty" json:"-"`  // The config's name.
}

ServiceTokenListOptions represents the options for the service-token list endpoint.

type ServiceTokenListResponse

type ServiceTokenListResponse struct {
	APIResponse `json:",inline"`
	Tokens      []*ServiceToken `json:"tokens"`
}

ServiceTokenListResponse represents a response from the service-token list endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/configs/config/tokens Docs: https://docs.doppler.com/reference/config-token-list

type ShareEncrypted

type ShareEncrypted struct {
	URL *string `json:"url,omitempty"`
}

ShareEncrypted allows to generate a Doppler Share link by sending an end-to-end encrypted secret.

type ShareEncryptedOptions

type ShareEncryptedOptions struct {
	Secret      string `url:"-" json:"encrypted_secret"`       // Base64 encoded AES-GCM encrypted secret to share. See docs for more details.
	Password    string `url:"-" json:"hashed_password"`        // SHA256 hash of the password. This is NOT the hash of the derived encryption key.
	KDF         string `url:"-" json:"encryption_kdf"`         // The key derivation function used. Must by "pbkdf2".
	SaltRounds  int32  `url:"-" json:"encryption_salt_rounds"` // Number of salt rounds used by KDF. Must be "100000".
	ExpireViews *int32 `url:"-" json:"expire_views,omitempty"` // Number of views before the link expires. Valid ranges: 1 to 50. -1 for unlimited.
	ExpireDays  *int32 `url:"-" json:"expire_days,omitempty"`  // Number of days before the link expires. Valid range: 1 to 90.
}

ShareEncryptedOptions represents the options for the share encrypted endpoint.

type ShareEncryptedResponse

type ShareEncryptedResponse struct {
	APIResponse `json:",inline"`
	Secret      *ShareEncrypted `json:",inline"`
}

ShareEncryptedResponse represents a response from the share encrypted endpoint.

Method: POST Endpoint: https://api.doppler.com/v1/share/secrets/encrypted Docs: https://docs.doppler.com/reference/share-secret-encrypted

type SharePlain

type SharePlain struct {
	URL              *string `json:"url,omitempty"`
	AuthenticatedURL *string `json:"authenticated_url,omitempty"`
	Password         *string `json:"password,omitempty"`
}

SharePlain allows to generate a Doppler Share link by sending a plain text secret.

type SharePlainOptions

type SharePlainOptions struct {
	Secret      string `url:"-" json:"secret"`                 // Plain text secret to share.
	ExpireViews *int32 `url:"-" json:"expire_views,omitempty"` // Number of views before the link expires. Valid ranges: 1 to 50. -1 for unlimited.
	ExpireDays  *int32 `url:"-" json:"expire_days,omitempty"`  // Number of days before the link expires. Valid range: 1 to 90.
}

SharePlainOptions represents the options for the share plain endpoint.

type SharePlainResponse

type SharePlainResponse struct {
	APIResponse `json:",inline"`
	Secret      *SharePlain `json:",inline"`
}

SharePlainResponse represents a response from the share plain endpoint.

Method: POST Endpoint: https://api.doppler.com/v1/share/secrets/plain Docs: https://docs.doppler.com/reference/share-secret

type User

type User struct {
	Email           *string `json:"email,omitempty"`             // The user's email address.
	Name            *string `json:"name,omitempty"`              // The user's name.
	UserName        *string `json:"username,omitempty"`          // The user's username.
	ProfileImageURL *string `json:"profile_image_url,omitempty"` // The user's profile image URL.
}

User represents a user in Doppler.

type Workplace

type Workplace struct {
	ID           *string `json:"id,omitempty"`            // ID of the workplace.
	Name         *string `json:"name,omitempty"`          // Name of the workplace.
	BillingEmail *string `json:"billing_email,omitempty"` // BillingEmail doppler will send invoices to.
}

Workplace represents a doppler workplace.

type WorkplaceGetResponse

type WorkplaceGetResponse struct {
	APIResponse `json:",inline"`
	Workplace   *Workplace `json:"workplace,omitempty"`
}

WorkplaceGetResponse represents a response from the workplace get endpoint.

Method: GET Endpoint: https://api.doppler.com/v3/workplace Docs: https://docs.doppler.com/reference/workplace-settings-retrieve

type WorkplaceUpdateOptions

type WorkplaceUpdateOptions struct {
	NewName         *string `json:"name,omitempty"`          // New name of the workplace.
	NewBillingEmail *string `json:"billing_email,omitempty"` // New billing email Doppler will send invoices to.
}

WorkplaceUpdateOptions represents a request to the workplace update endpoint.

type WorkplaceUpdateResponse

type WorkplaceUpdateResponse struct {
	APIResponse `json:",inline"`
	Workplace   *Workplace `json:"workplace"`
}

WorkplaceUpdateResponse represents a response from the workplace update endpoint.

Method: POST Endpoint: https://api.doppler.com/v3/workplace Docs: https://docs.doppler.com/reference/workplace-settings-update

Directories

Path Synopsis
Package activitylog provides a client for the Doppler API's logs endpoints.
Package activitylog provides a client for the Doppler API's logs endpoints.
Package audit provides a client for the Doppler API's audit endpoints.
Package audit provides a client for the Doppler API's audit endpoints.
Package auth provides a client for the Doppler API's auth endpoints.
Package auth provides a client for the Doppler API's auth endpoints.
Package config provides a client for the Doppler API's configs endpoints.
Package config provides a client for the Doppler API's configs endpoints.
Package configlog provides a client for the Doppler API's config logs endpoints.
Package configlog provides a client for the Doppler API's config logs endpoints.
Package environments provides a client for the Doppler API's environments endpoints.
Package environments provides a client for the Doppler API's environments endpoints.
Package logging provides a simple logging interface.
Package logging provides a simple logging interface.
Package pointer provides functions to create pointers to basic types.
Package pointer provides functions to create pointers to basic types.
Package project provides a client for the Doppler API's project endpoints.
Package project provides a client for the Doppler API's project endpoints.
Package secret provides a client for the Doppler API's secret endpoints.
Package secret provides a client for the Doppler API's secret endpoints.
Package servicetoken provides a client for the Doppler API's service token endpoints.
Package servicetoken provides a client for the Doppler API's service token endpoints.
Package share provides a client for the Doppler API's share endpoints.
Package share provides a client for the Doppler API's share endpoints.
Package workplace provides a client for the Doppler API's workplace endpoints.
Package workplace provides a client for the Doppler API's workplace endpoints.

Jump to

Keyboard shortcuts

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