api

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

View Source
const (
	Pat_basicScopes  = "pat_basic.Scopes"
	Pat_bearerScopes = "pat_bearer.Scopes"
)

Variables

View Source
var (
	ErrSignedOut            = errors.New("sign in required")
	ErrGnomeKeyringRequired = fmt.Errorf("gnome-keyring required for secure credential storage: %w", ErrSignedOut)
)

Functions

func PointerTo added in v0.0.8

func PointerTo[T any](v T) *T

Types

type AttachOrgServiceJSONBody added in v0.0.8

type AttachOrgServiceJSONBody struct {
	// Domains A list of domains for this attachment.
	Domains       []string `json:"domains"`
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
	} `json:"relationships"`
}

AttachOrgServiceJSONBody defines parameters for AttachOrgService.

type AttachOrgServiceJSONRequestBody added in v0.0.8

type AttachOrgServiceJSONRequestBody AttachOrgServiceJSONBody

AttachOrgServiceJSONRequestBody defines body for AttachOrgService for application/json ContentType.

type AuthCliCodesResponse added in v0.0.5

type AuthCliCodesResponse struct {
	// DeviceCode Unique code associated with origin device for CLI auth flow.
	DeviceCode string `json:"device_code"`

	// ExpiresIn Number of seconds until device and user codes expire, defaults to 900s (15m).
	ExpiresIn int32 `json:"expires_in"`

	// Interval Minimum number of seconds to wait before re-polling during CLI auth flow, defaults to 5s.
	Interval int32 `json:"interval"`

	// UserCode User verification code to be presented for the user to enter into a browser, formed by 8 characters with a hyphen in the middle.
	UserCode string `json:"user_code"`

	// VerificationUri The URL where the user will need to enter their code to complete the CLI auth flow.
	VerificationUri string `json:"verification_uri"`
}

AuthCliCodesResponse defines model for auth_cli_codes_response.

type AuthCliPatTokensResponse added in v0.0.5

type AuthCliPatTokensResponse struct {
	// PatToken Authenticated token for user API interactions.
	PatToken string `json:"pat_token"`
}

AuthCliPatTokensResponse defines model for auth_cli_pat_tokens_response.

type Chain added in v0.0.8

type Chain struct {
	// Name The name of the chain.
	Name          string `json:"name"`
	Relationships struct {
		Org struct {
			// Slug A value used as a parameter when referencing this org.
			Slug string `json:"slug"`
		} `json:"org"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
	} `json:"relationships"`

	// Slug A value used as a parameter when referencing this chain.
	Slug string `json:"slug"`
}

Chain defines model for chain.

type Client

type Client struct {
	// Name A name for the client.
	Name          string `json:"name"`
	Relationships *struct {
		Organization *struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization,omitempty"`
		Service *struct {
			// Slug A value used as a parameter when referencing this service.
			Slug string `json:"slug"`
		} `json:"service,omitempty"`
	} `json:"relationships,omitempty"`

	// Slug A value used as a parameter when referencing this client.
	Slug string `json:"slug"`

	// Type A type for the client.
	Type ClientType `json:"type"`
}

Client defines model for client.

type ClientType added in v0.0.8

type ClientType string

ClientType A type for the client.

const (
	ClientTypeCustom     ClientType = "custom"
	ClientTypeGo         ClientType = "go"
	ClientTypeJavascript ClientType = "javascript"
	ClientTypePython     ClientType = "python"
	ClientTypeRuby       ClientType = "ruby"
)

Defines values for ClientType.

type CreateCliTokenJSONBody added in v0.0.5

type CreateCliTokenJSONBody struct {
	// DeviceCode Unique code associated with origin device for CLI auth flow.
	DeviceCode string `json:"device_code"`
}

CreateCliTokenJSONBody defines parameters for CreateCliToken.

type CreateCliTokenJSONRequestBody added in v0.0.5

type CreateCliTokenJSONRequestBody CreateCliTokenJSONBody

CreateCliTokenJSONRequestBody defines body for CreateCliToken for application/json ContentType.

type CreateClientJSONBody added in v0.0.8

type CreateClientJSONBody struct {
	Relationships *struct {
		Organization *struct {
			Slug string `json:"slug"`
		} `json:"organization,omitempty"`
		Service *struct {
			Slug string `json:"slug"`
		} `json:"service,omitempty"`
	} `json:"relationships,omitempty"`
	ServerType *string `json:"server_type,omitempty"`
	Type       *string `json:"type,omitempty"`
}

CreateClientJSONBody defines parameters for CreateClient.

type CreateClientJSONRequestBody added in v0.0.8

type CreateClientJSONRequestBody CreateClientJSONBody

CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.

type CreateEabTokenJSONBody added in v0.0.7

type CreateEabTokenJSONBody struct {
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Organization struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
		Service struct {
			// Slug A value used as a parameter when referencing this service.
			Slug *string `json:"slug,omitempty"`
		} `json:"service,omitempty"`
		SubCa struct {
			// Slug A value used as a parameter when referencing this sub_ca.
			Slug string `json:"slug"`
		} `json:"sub_ca"`
	} `json:"relationships"`
}

CreateEabTokenJSONBody defines parameters for CreateEabToken.

type CreateEabTokenJSONRequestBody added in v0.0.7

type CreateEabTokenJSONRequestBody CreateEabTokenJSONBody

CreateEabTokenJSONRequestBody defines body for CreateEabToken for application/json ContentType.

type CreateServiceJSONBody added in v0.0.8

type CreateServiceJSONBody struct {
	LocalhostPort *int   `json:"localhost_port,omitempty"`
	Name          string `json:"name"`
	Relationships struct {
		Organization struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization"`
	} `json:"relationships"`
	ServerType string `json:"server_type"`
}

CreateServiceJSONBody defines parameters for CreateService.

type CreateServiceJSONRequestBody added in v0.0.8

type CreateServiceJSONRequestBody CreateServiceJSONBody

CreateServiceJSONRequestBody defines body for CreateService for application/json ContentType.

type Credential added in v0.0.1

type Credential struct {
	// CreatedAt UTC time when credential was created.
	CreatedAt time.Time `json:"created_at"`

	// Name name of credential
	Name string `json:"name"`

	// Revision Current revision of credential
	Revision int64 `json:"revision"`

	// RevokedAt UTC time after which credential will be revoked
	RevokedAt *time.Time `json:"revoked_at"`

	// Serial serial id for credential
	Serial string `json:"serial"`

	// SignatureAlgorithm Algorithm used to sign credential
	SignatureAlgorithm interface{} `json:"signature_algorithm"`

	// Status current status of credential
	Status CredentialStatus `json:"status"`

	// TextualEncoding base64 textual encoding of credential based on RFC7468
	TextualEncoding string `json:"textual_encoding"`

	// Uuid uuid for credential
	Uuid *openapi_types.UUID `json:"uuid,omitempty"`

	// ValidAfter UTC time after which credential will be valid.
	ValidAfter time.Time `json:"valid_after"`

	// ValidBefore UTC time after which credential will no longer be valid.
	ValidBefore time.Time `json:"valid_before"`
}

Credential defines model for credential.

type CredentialStatus added in v0.0.1

type CredentialStatus string

CredentialStatus current status of credential

const (
	Expired CredentialStatus = "expired"
	Online  CredentialStatus = "online"
	Revoked CredentialStatus = "revoked"
)

Defines values for CredentialStatus.

type Credentials added in v0.0.8

type Credentials struct {
	Items []Credential `json:"items"`
}

Credentials defines model for credentials.

type DetachOrgServiceJSONBody added in v0.0.8

type DetachOrgServiceJSONBody struct {
	// Domains A list of domains for this attachment.
	Domains       []string `json:"domains"`
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
	} `json:"relationships"`
}

DetachOrgServiceJSONBody defines parameters for DetachOrgService.

type DetachOrgServiceJSONRequestBody added in v0.0.8

type DetachOrgServiceJSONRequestBody DetachOrgServiceJSONBody

DetachOrgServiceJSONRequestBody defines body for DetachOrgService for application/json ContentType.

type Eab added in v0.0.7

type Eab struct {
	// HmacKey EAB HMAC key
	HmacKey string `json:"hmac_key"`

	// Kid EAB key identifier
	Kid           string `json:"kid"`
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Organization struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
		Service struct {
			// Slug A value used as a parameter when referencing this service.
			Slug string `json:"slug"`
		} `json:"service"`
		SubCa struct {
			// Slug A value used as a parameter when referencing this sub_ca.
			Slug string `json:"slug"`
		} `json:"sub_ca"`
	} `json:"relationships"`
}

Eab defines model for eab.

type Error

type Error struct {
	// Detail A human-readable description of this occurrence of the problem.
	Detail string `json:"detail"`

	// Status HTTP status code of this occurrence of the problem.
	Status int32 `json:"status"`

	// Title A human-readable description of this problem type.
	Title string `json:"title"`

	// Type URI identifying problem.
	Type string `json:"type"`
}

Error defines model for error.

type GetCredentialsParams added in v0.0.1

type GetCredentialsParams struct {
	// CaParam ca for operation
	CaParam *QueryCaParam `form:"ca_param,omitempty" json:"ca_param,omitempty"`
}

GetCredentialsParams defines parameters for GetCredentials.

type PathOrgParam

type PathOrgParam = string

PathOrgParam defines model for path_org_param.

type PathRealmParam

type PathRealmParam = string

PathRealmParam defines model for path_realm_param.

type PathServiceParam added in v0.0.8

type PathServiceParam = string

PathServiceParam defines model for path_service_param.

type QueryCaParam

type QueryCaParam = string

QueryCaParam defines model for query_ca_param.

type Root

type Root struct {
	PersonalOrg struct {
		Slug string `json:"slug"`
	} `json:"personal_org"`
	Whoami string `json:"whoami"`
}

Root defines model for root.

type Service added in v0.0.8

type Service struct {
	// LocalhostPort A port number for use on localhost or null.
	LocalhostPort *int `json:"localhost_port"`

	// Name A name for the service.
	Name          string `json:"name"`
	Relationships struct {
		Organization struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization"`
	} `json:"relationships"`

	// ServerType A server type for the service.
	ServerType ServiceServerType `json:"server_type"`

	// Slug A value used as a parameter when referencing this service.
	Slug string `json:"slug"`
}

Service defines model for service.

type ServiceServerType added in v0.0.8

type ServiceServerType string

ServiceServerType A server type for the service.

const (
	ServiceServerTypeCaddy      ServiceServerType = "caddy"
	ServiceServerTypeCustom     ServiceServerType = "custom"
	ServiceServerTypeDiagnostic ServiceServerType = "diagnostic"
	ServiceServerTypeGo         ServiceServerType = "go"
	ServiceServerTypeJavascript ServiceServerType = "javascript"
	ServiceServerTypePython     ServiceServerType = "python"
	ServiceServerTypeRuby       ServiceServerType = "ruby"
)

Defines values for ServiceServerType.

type Services added in v0.0.8

type Services struct {
	Items []Service `json:"items"`
}

Services defines model for services.

type ServicesXtach added in v0.0.8

type ServicesXtach struct {
	// Domains A list of domains for this attachment.
	Domains       []string `json:"domains"`
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Realm struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm"`
	} `json:"relationships"`
}

ServicesXtach defines model for services_xtach.

type ServicesXtach200 added in v0.0.8

type ServicesXtach200 struct {
	// Domains A list of domains for this attachment.
	Domains       []string `json:"domains"`
	Relationships struct {
		Chain struct {
			// Slug A value used as a parameter when referencing this chain.
			Slug string `json:"slug"`
		} `json:"chain"`
		Organization struct {
			// Slug A value used as a parameter when referencing this organization.
			Slug string `json:"slug"`
		} `json:"organization"`
		Realm *struct {
			// Slug A value used as a parameter when referencing this realm.
			Slug string `json:"slug"`
		} `json:"realm,omitempty"`
		Service struct {
			// Slug A value used as a parameter when referencing this services
			Slug string `json:"slug"`
		} `json:"service"`
		SubCa struct {
			// Slug A value used as a parameter when referencing this sub_ca
			Slug string `json:"slug"`
		} `json:"sub_ca"`
	} `json:"relationships"`
}

ServicesXtach200 defines model for services_xtach_200.

type Session added in v0.0.8

type Session struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewClient added in v0.0.8

func NewClient(cfg *cli.Config) (*Session, error)

TODO: rename to NewSession

func (*Session) AttachService added in v0.0.8

func (s *Session) AttachService(ctx context.Context, chainSlug string, domains []string, orgSlug, realmSlug, serviceSlug string) (*ServicesXtach200, error)

func (*Session) CreateEAB added in v0.0.8

func (s *Session) CreateEAB(ctx context.Context, chainSlug, orgSlug, realmSlug, serviceSlug, subCASlug string) (*Eab, error)

func (*Session) CreatePATToken added in v0.0.8

func (s *Session) CreatePATToken(ctx context.Context, deviceCode string) (string, error)

func (*Session) CreateService added in v0.0.8

func (s *Session) CreateService(ctx context.Context, orgSlug, serviceSlug, serverType string, localhostPort *int) (*Service, error)

func (*Session) FetchCredentials added in v0.0.8

func (s *Session) FetchCredentials(ctx context.Context, orgSlug, realmSlug string) ([]Credential, error)

func (*Session) GenerateUserFlowCodes added in v0.0.8

func (s *Session) GenerateUserFlowCodes(ctx context.Context, source string) (*AuthCliCodesResponse, error)

func (*Session) GetOrgServices added in v0.0.8

func (s *Session) GetOrgServices(ctx context.Context, orgSlug string) ([]Service, error)

func (*Session) GetService added in v0.0.8

func (s *Session) GetService(ctx context.Context, orgSlug, serviceSlug string) (*Service, error)

func (*Session) UserInfo added in v0.0.8

func (s *Session) UserInfo(ctx context.Context) (*Root, error)

type StatusCodeError added in v0.0.8

type StatusCodeError int

func (StatusCodeError) Error added in v0.0.8

func (err StatusCodeError) Error() string

func (StatusCodeError) StatusCode added in v0.0.8

func (err StatusCodeError) StatusCode() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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