client

package
v1.0.0-alpha.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	WorkspaceKey = "ORY_WORKSPACE"
	ProjectKey   = "ORY_PROJECT"

	WorkspaceAPIKey = "ORY_WORKSPACE_API_KEY"
	ProjectAPIKey   = "ORY_PROJECT_API_KEY"
)
View Source
const (
	ConfigFileName = ".ory-cloud.json"
	FlagConfig     = "config"
	ConfigPathKey  = "ORY_CONFIG_PATH"
	ConfigVersion  = "v1"
)
View Source
const (
	FlagWorkspace = "workspace"
	FlagProject   = "project"
	FlagYes       = "yes"
)
View Source
const (
	RateLimitHeaderKey = "ORY_RATE_LIMIT_HEADER"
	ConsoleURLKey      = "ORY_CONSOLE_URL"
	OryAPIsURLKey      = "ORY_ORYAPIS_URL"
)

Variables

View Source
var (
	ErrNoConfig         = errors.New("no ory configuration file present")
	ErrNoConfigQuiet    = errors.New("please authenticate the CLI or remove the `--quiet` flag")
	ErrNotAuthenticated = errors.New("you are not authenticated, please run `ory auth` to authenticate")
	ErrReauthenticate   = errors.New("your session or key has expired or has otherwise become invalid, re-authenticate to continue")
)
View Source
var ErrProjectNotSet = fmt.Errorf("no project was specified")

Functions

func CloudAPIsURL added in v0.1.42

func CloudAPIsURL(slug string) *url.URL

func CloudConsoleURL added in v0.1.42

func CloudConsoleURL(prefix string) *url.URL

func ContextWithClient

func ContextWithClient(ctx context.Context) context.Context

func ContextWithOptions added in v1.0.0

func ContextWithOptions(ctx context.Context, opts ...CommandHelperOption) context.Context

func NewPublicOryProjectClient added in v1.0.0

func NewPublicOryProjectClient() *cloud.APIClient

func ReadAndParseFiles added in v1.0.0

func ReadAndParseFiles(files []string) ([]json.RawMessage, error)

ReadAndParseFiles reads and parses JSON/YAML files from the given sources.

func RegisterConfigFlag

func RegisterConfigFlag(f *pflag.FlagSet)

func RegisterProjectFlag

func RegisterProjectFlag(f *pflag.FlagSet)

func RegisterWorkspaceFlag added in v1.0.0

func RegisterWorkspaceFlag(f *pflag.FlagSet)

func RegisterYesFlag

func RegisterYesFlag(f *pflag.FlagSet)

Types

type CommandHelper

type CommandHelper struct {
	VerboseErrWriter io.Writer
	Stdin            *bufio.Reader
	// contains filtered or unexported fields
}

func NewCobraCommandHelper added in v1.0.0

func NewCobraCommandHelper(cmd *cobra.Command, opts ...CommandHelperOption) (*CommandHelper, error)

NewCobraCommandHelper creates a new CommandHelper instance which handles cobra CLI commands.

func NewCommandHelper

func NewCommandHelper(ctx context.Context, opts ...CommandHelperOption) (*CommandHelper, error)

func (*CommandHelper) Authenticate

func (h *CommandHelper) Authenticate(ctx context.Context) error

func (*CommandHelper) ClearConfig added in v1.0.0

func (h *CommandHelper) ClearConfig() error

func (*CommandHelper) CreateEventStream added in v0.3.2

func (h *CommandHelper) CreateEventStream(ctx context.Context, projectID string, body cloud.CreateEventStreamBody) (*cloud.EventStream, error)

func (*CommandHelper) CreateOrganization added in v0.3.0

func (h *CommandHelper) CreateOrganization(ctx context.Context, projectID string, body cloud.OrganizationBody) (*cloud.Organization, error)

func (*CommandHelper) CreateProject

func (h *CommandHelper) CreateProject(ctx context.Context, name, environment string, workspace *string, setDefault bool) (*client.Project, error)

func (*CommandHelper) CreateProjectAPIKey added in v1.0.0

func (h *CommandHelper) CreateProjectAPIKey(ctx context.Context, projectID, name string) (*cloud.ProjectApiKey, error)

func (*CommandHelper) CreateWorkspace added in v1.0.0

func (h *CommandHelper) CreateWorkspace(ctx context.Context, name string) (*cloud.Workspace, error)

func (*CommandHelper) CreateWorkspaceAPIKey added in v1.0.0

func (h *CommandHelper) CreateWorkspaceAPIKey(ctx context.Context, workspaceID, name string) (*cloud.WorkspaceApiKey, error)

func (*CommandHelper) DeleteEventStream added in v0.3.2

func (h *CommandHelper) DeleteEventStream(ctx context.Context, projectID, streamID string) error

func (*CommandHelper) DeleteOrganization added in v0.3.0

func (h *CommandHelper) DeleteOrganization(ctx context.Context, projectID, orgID string) error

func (*CommandHelper) DeleteProjectAPIKey added in v1.0.0

func (h *CommandHelper) DeleteProjectAPIKey(ctx context.Context, projectID, keyID string) error

func (*CommandHelper) DeleteWorkspaceAPIKey added in v1.0.0

func (h *CommandHelper) DeleteWorkspaceAPIKey(ctx context.Context, workspaceID, keyID string) error

func (*CommandHelper) GetAuthenticatedConfig added in v1.0.0

func (h *CommandHelper) GetAuthenticatedConfig(ctx context.Context) (*Config, error)

func (*CommandHelper) GetProject

func (h *CommandHelper) GetProject(ctx context.Context, idOrSlug string, workspace *string) (*client.Project, error)

func (*CommandHelper) GetSelectedProject added in v1.0.0

func (h *CommandHelper) GetSelectedProject(ctx context.Context) (*client.Project, error)

func (*CommandHelper) ListEventStreams added in v0.3.2

func (h *CommandHelper) ListEventStreams(ctx context.Context, projectID string) (*cloud.ListEventStreams, error)

func (*CommandHelper) ListOrganizations added in v0.3.0

func (h *CommandHelper) ListOrganizations(ctx context.Context, projectID string) (*cloud.ListOrganizationsResponse, error)

func (*CommandHelper) ListProjects

func (h *CommandHelper) ListProjects(ctx context.Context, workspace *string) ([]client.ProjectMetadata, error)

func (*CommandHelper) ListWorkspaces added in v1.0.0

func (h *CommandHelper) ListWorkspaces(ctx context.Context) ([]cloud.Workspace, error)

func (*CommandHelper) OpenURL added in v1.0.0

func (h *CommandHelper) OpenURL(uri string) error

func (*CommandHelper) PatchProject

func (h *CommandHelper) PatchProject(ctx context.Context, id string, raw []json.RawMessage, add, replace, del []string) (*client.SuccessfulProjectUpdate, error)

func (*CommandHelper) PrintUpdateProjectWarnings

func (h *CommandHelper) PrintUpdateProjectWarnings(p *client.SuccessfulProjectUpdate) error

func (*CommandHelper) ProjectAuthToken added in v1.0.0

func (h *CommandHelper) ProjectAuthToken(ctx context.Context) (oauth2.TokenSource, func(string) *url.URL, error)

func (*CommandHelper) ProjectID added in v1.0.0

func (h *CommandHelper) ProjectID() (string, error)

func (*CommandHelper) SelectProject added in v1.0.0

func (h *CommandHelper) SelectProject(id string) error

func (*CommandHelper) SelectWorkspace added in v1.0.0

func (h *CommandHelper) SelectWorkspace(id string) error

func (*CommandHelper) SignOut

func (h *CommandHelper) SignOut(ctx context.Context) error

func (*CommandHelper) TemporaryAPIKey added in v1.0.0

func (h *CommandHelper) TemporaryAPIKey(ctx context.Context, name string) (apiKey string, cleanup func() error, err error)

func (*CommandHelper) UpdateConfig added in v1.0.0

func (h *CommandHelper) UpdateConfig(c *Config) error

func (*CommandHelper) UpdateEventStream added in v0.3.2

func (h *CommandHelper) UpdateEventStream(ctx context.Context, projectID, streamID string, body cloud.SetEventStreamBody) (*cloud.EventStream, error)

func (*CommandHelper) UpdateOrganization added in v0.3.0

func (h *CommandHelper) UpdateOrganization(ctx context.Context, projectID, orgID string, body cloud.OrganizationBody) (*cloud.Organization, error)

func (*CommandHelper) UpdateProject

func (h *CommandHelper) UpdateProject(ctx context.Context, id string, name string, configs []json.RawMessage) (*client.SuccessfulProjectUpdate, error)

func (*CommandHelper) UserName added in v1.0.0

func (h *CommandHelper) UserName(ctx context.Context) string

func (*CommandHelper) WorkspaceID added in v1.0.0

func (h *CommandHelper) WorkspaceID() *string

type CommandHelperOption added in v1.0.0

type CommandHelperOption func(*CommandHelper)

func WithConfigLocation added in v1.0.0

func WithConfigLocation(location string) CommandHelperOption

func WithNoConfirm added in v1.0.0

func WithNoConfirm(noConfirm bool) CommandHelperOption

func WithOpenBrowserHook added in v1.0.0

func WithOpenBrowserHook(openBrowser func(string) error) CommandHelperOption

func WithProjectAPIKey added in v1.0.0

func WithProjectAPIKey(apiKey string) CommandHelperOption

func WithProjectOverride added in v1.0.0

func WithProjectOverride(project string) CommandHelperOption

func WithQuiet added in v1.0.0

func WithQuiet(isQuiet bool) CommandHelperOption

func WithStdin added in v1.0.0

func WithStdin(r io.Reader) CommandHelperOption

func WithVerboseErrWriter added in v1.0.0

func WithVerboseErrWriter(w io.Writer) CommandHelperOption

func WithWorkspaceAPIKey added in v1.0.0

func WithWorkspaceAPIKey(apiKey string) CommandHelperOption

func WithWorkspaceOverride added in v1.0.0

func WithWorkspaceOverride(workspace string) CommandHelperOption

type Config added in v1.0.0

type Config struct {
	Version           string        `json:"version"`
	AccessToken       *oauth2.Token `json:"access_token"`
	SelectedProject   uuid.UUID     `json:"selected_project"`
	SelectedWorkspace uuid.UUID     `json:"selected_workspace"`
	IdentityTraits    Identity      `json:"session_identity_traits"`
	// contains filtered or unexported fields
}

func (*Config) Columns added in v1.0.0

func (c *Config) Columns() []string

func (*Config) Header added in v1.0.0

func (*Config) Header() []string

func (*Config) ID added in v1.0.0

func (c *Config) ID() string

func (*Config) Interface added in v1.0.0

func (c *Config) Interface() any

func (*Config) TokenSource added in v1.0.0

func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource

type Identity added in v1.0.0

type Identity struct {
	ID    uuid.UUID
	Email string `json:"email"`
	Name  string `json:"name"`
}

Jump to

Keyboard shortcuts

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