Documentation ¶
Index ¶
- Variables
- func AddNamespaceHeaders(ctx context.Context, headers *http.Header)
- func AnonymousCall(ctx context.Context, endpoint string, method string, req interface{}, ...) error
- func DecodeJSONResponse(resp any) func(io.Reader) error
- func LoginAsRobotAndStore(ctx context.Context, repository, accessToken string) (string, error)
- func Map(ctx context.Context, fqdn, target string) error
- func SetupFlags(flags *pflag.FlagSet)
- func StartLogin(ctx context.Context) (string, error)
- func StoreUser(ctx context.Context, userAuth *UserAuth) (string, error)
- func WithTelemetry(ctx context.Context) context.Context
- type AllocateOpts
- type Artifact
- type Call
- type CheckRequest
- type CompleteLoginRequest
- type GetLatestPrebuiltsRequest
- type GetLatestPrebuiltsResponse
- type GetLatestPrebuiltsResponse_Prebuilt
- type GetLatestRequest
- type GetLatestResponse
- type GetSessionTokenRequest
- type GetSessionTokenResponse
- type IssueRequest
- type IssueResponse
- type MapRequest
- type MapResponse
- type NSRequirements
- type NameCertificate
- type NameRequest
- type NameResource
- type ResourceID
- type RobotLoginRequest
- type StartLoginRequest
- type StartLoginResponse
- type Telemetry
- func (tel *Telemetry) Enable()
- func (tel *Telemetry) GetClientID() string
- func (tel *Telemetry) IsFirstRun() bool
- func (tel *Telemetry) IsTelemetryEnabled() bool
- func (tel *Telemetry) RecordError(ctx context.Context, err error)
- func (tel *Telemetry) RecordInvocation(ctx context.Context, cmd *cobra.Command, args []string) string
- type UserAuth
- func (*UserAuth) Descriptor() ([]byte, []int)deprecated
- func (x *UserAuth) GetOpaque() []byte
- func (x *UserAuth) GetOrg() string
- func (x *UserAuth) GetUsername() string
- func (*UserAuth) ProtoMessage()
- func (x *UserAuth) ProtoReflect() protoreflect.Message
- func (x *UserAuth) Reset()
- func (x *UserAuth) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var EndpointAddress = "https://api.namespacelabs.net"
View Source
var ErrRelogin = errors.New("not logged in, please run `ns login`")
View Source
var File_internal_fnapi_userauth_proto protoreflect.FileDescriptor
View Source
var NamingForceStored = false
Functions ¶
func AddNamespaceHeaders ¶ added in v0.0.82
func AnonymousCall ¶
func AnonymousCall(ctx context.Context, endpoint string, method string, req interface{}, handle func(io.Reader) error) error
A nil handle indicates that the caller wants to discard the response.
func LoginAsRobotAndStore ¶
func SetupFlags ¶
Types ¶
type AllocateOpts ¶
type AllocateOpts struct { Scope schema.PackageName `json:"-"` FQDN string `json:"fqdn,omitempty"` Subdomain string `json:"subdomain,omitempty"` NoTLS bool `json:"-"` Org string `json:"org,omitempty"` Stored *NameResource `json:"-"` }
JSON annotations below are used for the Arg() serialization below.
type Call ¶
type CheckRequest ¶
type CheckRequest struct {
UserData string `json:"userData"`
}
type CompleteLoginRequest ¶
type GetLatestPrebuiltsRequest ¶
type GetLatestPrebuiltsRequest struct {
PackageName []string `json:"package_name,omitempty"`
}
type GetLatestPrebuiltsResponse ¶
type GetLatestPrebuiltsResponse struct {
Prebuilt []*GetLatestPrebuiltsResponse_Prebuilt `json:"prebuilt,omitempty"`
}
func GetLatestPrebuilts ¶
func GetLatestPrebuilts(ctx context.Context, pkgs ...schema.PackageName) (*GetLatestPrebuiltsResponse, error)
type GetLatestRequest ¶
type GetLatestRequest struct {
NS NSRequirements `json:"ns"`
}
type GetLatestResponse ¶
type GetLatestResponse struct { Version string `json:"version"` BuildTime time.Time `json:"build_time"` Tarballs []*Artifact `json:"tarballs"` }
func GetLatestVersion ¶
func GetLatestVersion(ctx context.Context, nsReqs *schema.Workspace_FoundationRequirements) (*GetLatestResponse, error)
type GetSessionTokenRequest ¶
type GetSessionTokenResponse ¶
type GetSessionTokenResponse struct { Token string `json:"token"` Expiration time.Time `json:"expiration"` }
func GetSessionToken ¶
type IssueRequest ¶
type IssueRequest struct { UserAuth *UserAuth `json:"user_auth"` NameRequest NameRequest `json:"name_request"` Resource NameResource `json:"previous"` }
type IssueResponse ¶
type IssueResponse struct {
Resource NameResource `json:"resource"`
}
type MapRequest ¶
type MapResponse ¶
type MapResponse struct {
FQDN string `json:"fqdn"`
}
type NSRequirements ¶
type NSRequirements struct {
MinimumApi int32 `json:"minimum_api"`
}
type NameCertificate ¶
type NameRequest ¶
type NameResource ¶
type NameResource struct { ID ResourceID `json:"id"` Certificate NameCertificate `json:"certificate"` }
func AllocateName ¶
func AllocateName(ctx context.Context, opts AllocateOpts) (*NameResource, error)
type ResourceID ¶
type ResourceID struct {
Opaque []byte `json:"opaque"`
}
type RobotLoginRequest ¶
type StartLoginRequest ¶
type StartLoginRequest struct{}
type StartLoginResponse ¶
type StartLoginResponse struct {
LoginId string `json:"login_id"`
}
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
func InternalNewTelemetry ¶ added in v0.0.76
func NewTelemetry ¶
func TelemetryOn ¶
func (*Telemetry) Enable ¶
func (tel *Telemetry) Enable()
Telemetry needs to be excplicitly enabled by calling this function. IsTelemetryEnabled() may still be false if telemetry is disabled through DO_NOT_TRACK, etc.
func (*Telemetry) GetClientID ¶ added in v0.0.76
func (*Telemetry) IsFirstRun ¶ added in v0.0.76
func (*Telemetry) IsTelemetryEnabled ¶
type UserAuth ¶
type UserAuth struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` Org string `protobuf:"bytes,2,opt,name=org,proto3" json:"org,omitempty"` // The organization this user is acting as. Only really relevant for robot accounts which authenticate against a repository. Opaque []byte `protobuf:"bytes,3,opt,name=opaque,proto3" json:"opaque,omitempty"` // contains filtered or unexported fields }
func CompleteLogin ¶
func RobotLogin ¶
func (*UserAuth) Descriptor
deprecated
func (*UserAuth) GetUsername ¶
func (*UserAuth) ProtoMessage ¶
func (*UserAuth) ProtoMessage()
func (*UserAuth) ProtoReflect ¶
func (x *UserAuth) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.