Documentation
¶
Overview ¶
Package client provides a client for the opampcommander API server.
Index ¶
- Constants
- Variables
- type AgentGroupListResponse
- type AgentGroupService
- func (s *AgentGroupService) CreateAgentGroup(ctx context.Context, namespace string, createRequest *v1.AgentGroup) (*v1.AgentGroup, error)
- func (s *AgentGroupService) DeleteAgentGroup(ctx context.Context, namespace string, name string) error
- func (s *AgentGroupService) GetAgentGroup(ctx context.Context, namespace string, name string, opts ...GetOption) (*v1.AgentGroup, error)
- func (s *AgentGroupService) ListAgentGroups(ctx context.Context, namespace string, opts ...ListOption) (*AgentGroupListResponse, error)
- func (s *AgentGroupService) ListAgentsByAgentGroup(ctx context.Context, namespace string, name string, opts ...ListOption) (*AgentListResponse, error)
- func (s *AgentGroupService) UpdateAgentGroup(ctx context.Context, updateRequest *v1.AgentGroup) (*v1.AgentGroup, error)
- type AgentListResponse
- type AgentPackageListResponse
- type AgentPackageService
- func (s *AgentPackageService) CreateAgentPackage(ctx context.Context, namespace string, createRequest *v1.AgentPackage) (*v1.AgentPackage, error)
- func (s *AgentPackageService) DeleteAgentPackage(ctx context.Context, namespace string, name string) error
- func (s *AgentPackageService) GetAgentPackage(ctx context.Context, namespace string, name string) (*v1.AgentPackage, error)
- func (s *AgentPackageService) ListAgentPackages(ctx context.Context, namespace string, opts ...ListOption) (*AgentPackageListResponse, error)
- func (s *AgentPackageService) UpdateAgentPackage(ctx context.Context, updateRequest *v1.AgentPackage) (*v1.AgentPackage, error)
- type AgentRemoteConfigListResponse
- type AgentRemoteConfigService
- func (s *AgentRemoteConfigService) CreateAgentRemoteConfig(ctx context.Context, namespace string, createRequest *v1.AgentRemoteConfig) (*v1.AgentRemoteConfig, error)
- func (s *AgentRemoteConfigService) DeleteAgentRemoteConfig(ctx context.Context, namespace string, name string) error
- func (s *AgentRemoteConfigService) GetAgentRemoteConfig(ctx context.Context, namespace string, name string) (*v1.AgentRemoteConfig, error)
- func (s *AgentRemoteConfigService) ListAgentRemoteConfigs(ctx context.Context, namespace string, opts ...ListOption) (*AgentRemoteConfigListResponse, error)
- func (s *AgentRemoteConfigService) UpdateAgentRemoteConfig(ctx context.Context, updateRequest *v1.AgentRemoteConfig) (*v1.AgentRemoteConfig, error)
- type AgentService
- func (s *AgentService) GetAgent(ctx context.Context, namespace string, id uuid.UUID) (*v1.Agent, error)
- func (s *AgentService) ListAgents(ctx context.Context, namespace string, opts ...ListOption) (*AgentListResponse, error)
- func (s *AgentService) RestartAgent(ctx context.Context, namespace string, id uuid.UUID) (*v1.Agent, error)
- func (s *AgentService) SearchAgents(ctx context.Context, namespace string, query string, opts ...ListOption) (*AgentListResponse, error)
- func (s *AgentService) SetAgentNewInstanceUID(ctx context.Context, namespace string, id uuid.UUID, ...) (*v1.Agent, error)
- func (s *AgentService) UpdateAgent(ctx context.Context, namespace string, id uuid.UUID, agent *v1.Agent) (*v1.Agent, error)
- type AuthService
- func (s *AuthService) ExchangeDeviceAuthToken(deviceCode string, expiry time.Time) (*v1auth.AuthnTokenResponse, error)
- func (s *AuthService) GetAuthTokenByBasicAuth(username, password string) (*v1auth.AuthnTokenResponse, error)
- func (s *AuthService) GetDeviceAuthToken() (*v1auth.DeviceAuthnTokenResponse, error)
- func (s *AuthService) GetInfo() (*v1auth.InfoResponse, error)
- type CertificateListResponse
- type CertificateService
- func (s *CertificateService) CreateCertificate(ctx context.Context, namespace string, createRequest *v1.Certificate) (*v1.Certificate, error)
- func (s *CertificateService) DeleteCertificate(ctx context.Context, namespace string, name string) error
- func (s *CertificateService) GetCertificate(ctx context.Context, namespace string, name string) (*v1.Certificate, error)
- func (s *CertificateService) ListCertificates(ctx context.Context, namespace string, opts ...ListOption) (*CertificateListResponse, error)
- func (s *CertificateService) UpdateCertificate(ctx context.Context, updateRequest *v1.Certificate) (*v1.Certificate, error)
- type Client
- func (c *Client) GetServerVersion(ctx context.Context) (*v1version.Info, error)
- func (c *Client) Ping() error
- func (c *Client) SetAuthToken(bearerToken string)
- func (c *Client) SetBasicAuth(username, password string)
- func (c *Client) SetLogger(logger *slog.Logger)
- func (c *Client) SetVerbose(verbose bool)
- type ConnectionService
- type GetOption
- type GetOptionFunc
- type GetSettings
- type ListOption
- type ListOptionFunc
- type ListSettings
- type NamespaceListResponse
- type NamespaceService
- func (s *NamespaceService) CreateNamespace(ctx context.Context, createRequest *v1.Namespace) (*v1.Namespace, error)
- func (s *NamespaceService) DeleteNamespace(ctx context.Context, name string) error
- func (s *NamespaceService) GetNamespace(ctx context.Context, name string) (*v1.Namespace, error)
- func (s *NamespaceService) ListNamespaces(ctx context.Context, opts ...ListOption) (*NamespaceListResponse, error)
- func (s *NamespaceService) UpdateNamespace(ctx context.Context, name string, updateRequest *v1.Namespace) (*v1.Namespace, error)
- type Option
- type OptionFunc
- type RBACService
- func (s *RBACService) CheckPermission(ctx context.Context, req *v1.CheckPermissionRequest) (*v1.CheckPermissionResponse, error)
- func (s *RBACService) GetUserPermissions(ctx context.Context, userID string) (*v1.ListResponse[v1.Permission], error)
- func (s *RBACService) GetUserRoles(ctx context.Context, userID string) (*v1.ListResponse[v1.Role], error)
- func (s *RBACService) SyncPolicies(ctx context.Context) error
- type ResponseError
- type RoleBindingListResponse
- type RoleBindingService
- func (s *RoleBindingService) CreateRoleBinding(ctx context.Context, namespace string, createRequest *v1.RoleBinding) (*v1.RoleBinding, error)
- func (s *RoleBindingService) DeleteRoleBinding(ctx context.Context, namespace string, name string) error
- func (s *RoleBindingService) GetRoleBinding(ctx context.Context, namespace string, name string) (*v1.RoleBinding, error)
- func (s *RoleBindingService) ListRoleBindings(ctx context.Context, namespace string, opts ...ListOption) (*RoleBindingListResponse, error)
- func (s *RoleBindingService) UpdateRoleBinding(ctx context.Context, updateRequest *v1.RoleBinding) (*v1.RoleBinding, error)
- type RoleListResponse
- type RoleService
- func (s *RoleService) CreateRole(ctx context.Context, role *v1.Role) (*v1.Role, error)
- func (s *RoleService) DeleteRole(ctx context.Context, uid string) error
- func (s *RoleService) GetRole(ctx context.Context, uid string) (*v1.Role, error)
- func (s *RoleService) ListRoles(ctx context.Context, opts ...ListOption) (*RoleListResponse, error)
- func (s *RoleService) UpdateRole(ctx context.Context, uid string, role *v1.Role) (*v1.Role, error)
- type SetNewInstanceUIDRequest
- type UserListResponse
- type UserService
- func (s *UserService) CreateUser(ctx context.Context, user *v1.User) (*v1.User, error)
- func (s *UserService) DeleteUser(ctx context.Context, uid string) error
- func (s *UserService) GetMyProfile(ctx context.Context) (*v1.UserProfileResponse, error)
- func (s *UserService) GetUser(ctx context.Context, uid string) (*v1.User, error)
- func (s *UserService) ListUsers(ctx context.Context, opts ...ListOption) (*UserListResponse, error)
Constants ¶
const ( // ListAgentURL is the path to list all agents in a namespace. ListAgentURL = "/api/v1/namespaces/{namespace}/agents" // SearchAgentURL is the path to search agents in a namespace. SearchAgentURL = "/api/v1/namespaces/{namespace}/agents/search" // GetAgentURL is the path to get an agent by ID in a namespace. GetAgentURL = "/api/v1/namespaces/{namespace}/agents/{id}" // UpdateAgentURL is the path to update an agent in a namespace. UpdateAgentURL = "/api/v1/namespaces/{namespace}/agents/{id}" )
const ( // ListAgentGroupURL is the path to list all agent groups within a namespace. ListAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups" // ListAgentsByAgentGroupURL is the path to list all agents in an agent group. ListAgentsByAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups/{name}/agents" // GetAgentGroupURL is the path to get an agent group by namespace and name. GetAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups/{id}" // CreateAgentGroupURL is the path to create a new agent group. CreateAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups" // UpdateAgentGroupURL is the path to update an existing agent group. UpdateAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups/{id}" // DeleteAgentGroupURL is the path to delete an agent group. DeleteAgentGroupURL = "/api/v1/namespaces/{namespace}/agentgroups/{id}" )
const ( // ListAgentPackageURL is the path to list all agent packages. ListAgentPackageURL = "/api/v1/namespaces/{namespace}/agentpackages" // GetAgentPackageURL is the path to get an agent package by name. GetAgentPackageURL = "/api/v1/namespaces/{namespace}/agentpackages/{id}" // CreateAgentPackageURL is the path to create a new agent package. CreateAgentPackageURL = "/api/v1/namespaces/{namespace}/agentpackages" // UpdateAgentPackageURL is the path to update an existing agent package. UpdateAgentPackageURL = "/api/v1/namespaces/{namespace}/agentpackages/{id}" // DeleteAgentPackageURL is the path to delete an agent package. DeleteAgentPackageURL = "/api/v1/namespaces/{namespace}/agentpackages/{id}" )
const ( // ListAgentRemoteConfigURL is the path to list all agent remote configs. ListAgentRemoteConfigURL = "/api/v1/namespaces/{namespace}/agentremoteconfigs" // GetAgentRemoteConfigURL is the path to get an agent remote config by name. GetAgentRemoteConfigURL = "/api/v1/namespaces/{namespace}/agentremoteconfigs/{id}" // CreateAgentRemoteConfigURL is the path to create a new agent remote config. CreateAgentRemoteConfigURL = "/api/v1/namespaces/{namespace}/agentremoteconfigs" // UpdateAgentRemoteConfigURL is the path to update an existing agent remote config. UpdateAgentRemoteConfigURL = "/api/v1/namespaces/{namespace}/agentremoteconfigs/{id}" // DeleteAgentRemoteConfigURL is the path to delete an agent remote config. DeleteAgentRemoteConfigURL = "/api/v1/namespaces/{namespace}/agentremoteconfigs/{id}" )
const ( // GithubAuthDeviceAuthAPIURL is the API URL for GitHub device authentication. GithubAuthDeviceAuthAPIURL = "/api/v1/auth/github/device" // GithubAuthExchangeDeviceAuthAPIURL is the API URL for exchanging GitHub device authentication tokens. GithubAuthExchangeDeviceAuthAPIURL = "/api/v1/auth/github/device/exchange" // BasicAuthAPIURL is the API URL for basic authentication. BasicAuthAPIURL = "/api/v1/auth/basic" // InfoAPIURL is the API URL to fetch auth info. InfoAPIURL = "/api/v1/auth/info" )
const ( // ListCertificateURL is the path to list all certificates. ListCertificateURL = "/api/v1/namespaces/{namespace}/certificates" // GetCertificateURL is the path to get a certificate by name. GetCertificateURL = "/api/v1/namespaces/{namespace}/certificates/{id}" // CreateCertificateURL is the path to create a new certificate. CreateCertificateURL = "/api/v1/namespaces/{namespace}/certificates" // UpdateCertificateURL is the path to update an existing certificate. UpdateCertificateURL = "/api/v1/namespaces/{namespace}/certificates/{id}" // DeleteCertificateURL is the path to delete a certificate. DeleteCertificateURL = "/api/v1/namespaces/{namespace}/certificates/{id}" )
const ( // ListConnectionsPath is the path to list connections in a namespace. ListConnectionsPath = "/api/v1/namespaces/{namespace}/connections" // GetConnectionPath is the path to get a connection by ID in a namespace. GetConnectionPath = "/api/v1/namespaces/{namespace}/connections/{id}" )
API paths for connection resources.
const ( // ListNamespaceURL is the path to list all namespaces. ListNamespaceURL = "/api/v1/namespaces" // GetNamespaceURL is the path to get a namespace by name. GetNamespaceURL = "/api/v1/namespaces/{id}" // CreateNamespaceURL is the path to create a new namespace. CreateNamespaceURL = "/api/v1/namespaces" // UpdateNamespaceURL is the path to update an existing namespace. UpdateNamespaceURL = "/api/v1/namespaces/{id}" // DeleteNamespaceURL is the path to delete a namespace. DeleteNamespaceURL = "/api/v1/namespaces/{id}" )
const ( // CheckPermissionURL is the path to check a user's permission. CheckPermissionURL = "/api/v1/rbac/check" // GetUserRolesURL is the path to get a user's roles. GetUserRolesURL = "/api/v1/rbac/users/{id}/roles" // GetUserPermissionsURL is the path to get a user's permissions. GetUserPermissionsURL = "/api/v1/rbac/users/{id}/permissions" // SyncPoliciesURL is the path to sync RBAC policies. SyncPoliciesURL = "/api/v1/rbac/sync" )
const ( // ListRoleURL is the path to list all roles. ListRoleURL = "/api/v1/roles" // GetRoleURL is the path to get a role by ID. GetRoleURL = "/api/v1/roles/{id}" // CreateRoleURL is the path to create a new role. CreateRoleURL = "/api/v1/roles" // UpdateRoleURL is the path to update an existing role. UpdateRoleURL = "/api/v1/roles/{id}" // DeleteRoleURL is the path to delete a role. DeleteRoleURL = "/api/v1/roles/{id}" )
const ( // ListRoleBindingURL is the path to list all role bindings within a namespace. ListRoleBindingURL = "/api/v1/namespaces/{namespace}/rolebindings" // GetRoleBindingURL is the path to get a role binding by namespace and name. GetRoleBindingURL = "/api/v1/namespaces/{namespace}/rolebindings/{id}" // CreateRoleBindingURL is the path to create a new role binding. CreateRoleBindingURL = "/api/v1/namespaces/{namespace}/rolebindings" // UpdateRoleBindingURL is the path to update an existing role binding. UpdateRoleBindingURL = "/api/v1/namespaces/{namespace}/rolebindings/{id}" // DeleteRoleBindingURL is the path to delete a role binding. DeleteRoleBindingURL = "/api/v1/namespaces/{namespace}/rolebindings/{id}" )
const ( // ListUserURL is the path to list all users. ListUserURL = "/api/v1/users" // GetUserURL is the path to get a user by ID. GetUserURL = "/api/v1/users/{id}" // CreateUserURL is the path to create a new user. CreateUserURL = "/api/v1/users" // DeleteUserURL is the path to delete a user. DeleteUserURL = "/api/v1/users/{id}" // GetUserProfileURL is the path to get the current user's profile. GetUserProfileURL = "/api/v1/users/me" )
Variables ¶
var ( // ErrEmptyResponse is an error that indicates that the response from the server is empty. ErrEmptyResponse = errors.New("empty response") // ErrUnexpectedBehavior is an error that indicates that the server behavior is not as expected. ErrUnexpectedBehavior = errors.New("unexpected behavior") )
Functions ¶
This section is empty.
Types ¶
type AgentGroupListResponse ¶ added in v0.1.27
type AgentGroupListResponse = v1.ListResponse[v1.AgentGroup]
AgentGroupListResponse represents a list of agent groups with metadata.
type AgentGroupService ¶ added in v0.1.20
type AgentGroupService struct {
// contains filtered or unexported fields
}
AgentGroupService provides methods to interact with agent groups.
func NewAgentGroupService ¶ added in v0.1.20
func NewAgentGroupService(service *service) *AgentGroupService
NewAgentGroupService creates a new AgentGroupService.
func (*AgentGroupService) CreateAgentGroup ¶ added in v0.1.20
func (s *AgentGroupService) CreateAgentGroup( ctx context.Context, namespace string, createRequest *v1.AgentGroup, ) (*v1.AgentGroup, error)
CreateAgentGroup creates a new agent group.
func (*AgentGroupService) DeleteAgentGroup ¶ added in v0.1.20
func (s *AgentGroupService) DeleteAgentGroup(ctx context.Context, namespace string, name string) error
DeleteAgentGroup deletes an agent group by its namespace and name.
func (*AgentGroupService) GetAgentGroup ¶ added in v0.1.20
func (s *AgentGroupService) GetAgentGroup( ctx context.Context, namespace string, name string, opts ...GetOption, ) (*v1.AgentGroup, error)
GetAgentGroup retrieves an agent group by its namespace and name.
func (*AgentGroupService) ListAgentGroups ¶ added in v0.1.20
func (s *AgentGroupService) ListAgentGroups( ctx context.Context, namespace string, opts ...ListOption, ) (*AgentGroupListResponse, error)
ListAgentGroups lists all agent groups in a namespace.
func (*AgentGroupService) ListAgentsByAgentGroup ¶ added in v0.1.22
func (s *AgentGroupService) ListAgentsByAgentGroup( ctx context.Context, namespace string, name string, opts ...ListOption, ) (*AgentListResponse, error)
ListAgentsByAgentGroup lists agents belonging to a specific agent group.
func (*AgentGroupService) UpdateAgentGroup ¶ added in v0.1.20
func (s *AgentGroupService) UpdateAgentGroup( ctx context.Context, updateRequest *v1.AgentGroup, ) (*v1.AgentGroup, error)
UpdateAgentGroup updates an existing agent group.
type AgentListResponse ¶ added in v0.1.27
type AgentListResponse = v1.ListResponse[v1.Agent]
AgentListResponse represents a list of agents with metadata.
type AgentPackageListResponse ¶ added in v0.1.28
type AgentPackageListResponse = v1.ListResponse[v1.AgentPackage]
AgentPackageListResponse represents a list of agent packages with metadata.
type AgentPackageService ¶ added in v0.1.28
type AgentPackageService struct {
// contains filtered or unexported fields
}
AgentPackageService provides methods to interact with agent packages.
func NewAgentPackageService ¶ added in v0.1.28
func NewAgentPackageService(service *service) *AgentPackageService
NewAgentPackageService creates a new AgentPackageService.
func (*AgentPackageService) CreateAgentPackage ¶ added in v0.1.28
func (s *AgentPackageService) CreateAgentPackage( ctx context.Context, namespace string, createRequest *v1.AgentPackage, ) (*v1.AgentPackage, error)
CreateAgentPackage creates a new agent package.
func (*AgentPackageService) DeleteAgentPackage ¶ added in v0.1.28
func (s *AgentPackageService) DeleteAgentPackage( ctx context.Context, namespace string, name string, ) error
DeleteAgentPackage deletes an agent package by its namespace and name.
func (*AgentPackageService) GetAgentPackage ¶ added in v0.1.28
func (s *AgentPackageService) GetAgentPackage( ctx context.Context, namespace string, name string, ) (*v1.AgentPackage, error)
GetAgentPackage retrieves an agent package by its namespace and name.
func (*AgentPackageService) ListAgentPackages ¶ added in v0.1.28
func (s *AgentPackageService) ListAgentPackages( ctx context.Context, namespace string, opts ...ListOption, ) (*AgentPackageListResponse, error)
ListAgentPackages lists all agent packages in a namespace.
func (*AgentPackageService) UpdateAgentPackage ¶ added in v0.1.28
func (s *AgentPackageService) UpdateAgentPackage( ctx context.Context, updateRequest *v1.AgentPackage, ) (*v1.AgentPackage, error)
UpdateAgentPackage updates an existing agent package.
type AgentRemoteConfigListResponse ¶ added in v0.1.28
type AgentRemoteConfigListResponse = v1.ListResponse[v1.AgentRemoteConfig]
AgentRemoteConfigListResponse represents a list of agent remote configs with metadata.
type AgentRemoteConfigService ¶ added in v0.1.28
type AgentRemoteConfigService struct {
// contains filtered or unexported fields
}
AgentRemoteConfigService provides methods to interact with agent remote configs.
func NewAgentRemoteConfigService ¶ added in v0.1.28
func NewAgentRemoteConfigService(service *service) *AgentRemoteConfigService
NewAgentRemoteConfigService creates a new AgentRemoteConfigService.
func (*AgentRemoteConfigService) CreateAgentRemoteConfig ¶ added in v0.1.28
func (s *AgentRemoteConfigService) CreateAgentRemoteConfig( ctx context.Context, namespace string, createRequest *v1.AgentRemoteConfig, ) (*v1.AgentRemoteConfig, error)
CreateAgentRemoteConfig creates a new agent remote config.
func (*AgentRemoteConfigService) DeleteAgentRemoteConfig ¶ added in v0.1.28
func (s *AgentRemoteConfigService) DeleteAgentRemoteConfig( ctx context.Context, namespace string, name string, ) error
DeleteAgentRemoteConfig deletes an agent remote config by namespace and name.
func (*AgentRemoteConfigService) GetAgentRemoteConfig ¶ added in v0.1.28
func (s *AgentRemoteConfigService) GetAgentRemoteConfig( ctx context.Context, namespace string, name string, ) (*v1.AgentRemoteConfig, error)
GetAgentRemoteConfig retrieves an agent remote config by its namespace and name.
func (*AgentRemoteConfigService) ListAgentRemoteConfigs ¶ added in v0.1.28
func (s *AgentRemoteConfigService) ListAgentRemoteConfigs( ctx context.Context, namespace string, opts ...ListOption, ) (*AgentRemoteConfigListResponse, error)
ListAgentRemoteConfigs lists all agent remote configs in a namespace.
func (*AgentRemoteConfigService) UpdateAgentRemoteConfig ¶ added in v0.1.28
func (s *AgentRemoteConfigService) UpdateAgentRemoteConfig( ctx context.Context, updateRequest *v1.AgentRemoteConfig, ) (*v1.AgentRemoteConfig, error)
UpdateAgentRemoteConfig updates an existing agent remote config.
type AgentService ¶ added in v0.1.1
type AgentService struct {
// contains filtered or unexported fields
}
AgentService provides methods to interact with agents.
func NewAgentService ¶ added in v0.1.1
func NewAgentService(service *service) *AgentService
NewAgentService creates a new AgentService.
func (*AgentService) GetAgent ¶ added in v0.1.1
func (s *AgentService) GetAgent( ctx context.Context, namespace string, id uuid.UUID, ) (*v1.Agent, error)
GetAgent retrieves an agent by its namespace and ID.
func (*AgentService) ListAgents ¶ added in v0.1.1
func (s *AgentService) ListAgents( ctx context.Context, namespace string, opts ...ListOption, ) (*AgentListResponse, error)
ListAgents lists all agents in a namespace.
func (*AgentService) RestartAgent ¶ added in v0.1.24
func (s *AgentService) RestartAgent( ctx context.Context, namespace string, id uuid.UUID, ) (*v1.Agent, error)
RestartAgent restarts an agent by its ID.
func (*AgentService) SearchAgents ¶ added in v0.1.25
func (s *AgentService) SearchAgents( ctx context.Context, namespace string, query string, opts ...ListOption, ) (*AgentListResponse, error)
SearchAgents searches agents by query in a namespace.
func (*AgentService) SetAgentNewInstanceUID ¶ added in v0.1.24
func (s *AgentService) SetAgentNewInstanceUID( ctx context.Context, namespace string, id uuid.UUID, request SetNewInstanceUIDRequest, ) (*v1.Agent, error)
SetAgentNewInstanceUID sets a new instance UID for an agent.
type AuthService ¶ added in v0.1.1
type AuthService struct {
// contains filtered or unexported fields
}
AuthService provides methods to interact with authentication resources.
func NewAuthService ¶ added in v0.1.1
func NewAuthService(service *service) *AuthService
NewAuthService creates a new AuthService.
func (*AuthService) ExchangeDeviceAuthToken ¶ added in v0.1.1
func (s *AuthService) ExchangeDeviceAuthToken(deviceCode string, expiry time.Time) (*v1auth.AuthnTokenResponse, error)
ExchangeDeviceAuthToken exchanges a device code for an authentication token.
func (*AuthService) GetAuthTokenByBasicAuth ¶ added in v0.1.1
func (s *AuthService) GetAuthTokenByBasicAuth(username, password string) (*v1auth.AuthnTokenResponse, error)
GetAuthTokenByBasicAuth retrieves an authentication token using basic authentication.
func (*AuthService) GetDeviceAuthToken ¶ added in v0.1.1
func (s *AuthService) GetDeviceAuthToken() (*v1auth.DeviceAuthnTokenResponse, error)
GetDeviceAuthToken retrieves a device authentication token from GitHub.
func (*AuthService) GetInfo ¶ added in v0.1.1
func (s *AuthService) GetInfo() (*v1auth.InfoResponse, error)
GetInfo retrieves authentication information from the server.
type CertificateListResponse ¶ added in v0.1.28
type CertificateListResponse = v1.ListResponse[v1.Certificate]
CertificateListResponse represents a list of certificates with metadata.
type CertificateService ¶ added in v0.1.28
type CertificateService struct {
// contains filtered or unexported fields
}
CertificateService provides methods to interact with certificates.
func NewCertificateService ¶ added in v0.1.28
func NewCertificateService(service *service) *CertificateService
NewCertificateService creates a new CertificateService.
func (*CertificateService) CreateCertificate ¶ added in v0.1.28
func (s *CertificateService) CreateCertificate( ctx context.Context, namespace string, createRequest *v1.Certificate, ) (*v1.Certificate, error)
CreateCertificate creates a new certificate.
func (*CertificateService) DeleteCertificate ¶ added in v0.1.28
func (s *CertificateService) DeleteCertificate( ctx context.Context, namespace string, name string, ) error
DeleteCertificate deletes a certificate by its namespace and name.
func (*CertificateService) GetCertificate ¶ added in v0.1.28
func (s *CertificateService) GetCertificate( ctx context.Context, namespace string, name string, ) (*v1.Certificate, error)
GetCertificate retrieves a certificate by its namespace and name.
func (*CertificateService) ListCertificates ¶ added in v0.1.28
func (s *CertificateService) ListCertificates( ctx context.Context, namespace string, opts ...ListOption, ) (*CertificateListResponse, error)
ListCertificates lists all certificates in a namespace.
func (*CertificateService) UpdateCertificate ¶ added in v0.1.28
func (s *CertificateService) UpdateCertificate( ctx context.Context, updateRequest *v1.Certificate, ) (*v1.Certificate, error)
UpdateCertificate updates an existing certificate.
type Client ¶
type Client struct {
Endpoint string
AgentService *AgentService
AgentGroupService *AgentGroupService
AgentPackageService *AgentPackageService
AgentRemoteConfigService *AgentRemoteConfigService
CertificateService *CertificateService
ConnectionService *ConnectionService
AuthService *AuthService
NamespaceService *NamespaceService
UserService *UserService
RoleService *RoleService
RBACService *RBACService
RoleBindingService *RoleBindingService
// contains filtered or unexported fields
}
Client is a struct that contains the endpoint and the resty client.
func (*Client) GetServerVersion ¶ added in v0.1.18
GetServerVersion retrieves the server version information.
func (*Client) SetAuthToken ¶ added in v0.1.1
SetAuthToken sets the authentication token for the client.
func (*Client) SetBasicAuth ¶ added in v0.1.35
SetBasicAuth sets the basic authentication credentials for the client.
func (*Client) SetVerbose ¶ added in v0.1.10
SetVerbose enables verbose logging for the client.
type ConnectionService ¶ added in v0.1.1
type ConnectionService struct {
// contains filtered or unexported fields
}
ConnectionService provides methods to interact with connection resources.
func NewConnectionService ¶ added in v0.1.1
func NewConnectionService(service *service) *ConnectionService
NewConnectionService creates a new ConnectionService.
func (*ConnectionService) GetConnection ¶ added in v0.1.1
func (s *ConnectionService) GetConnection( ctx context.Context, namespace string, id uuid.UUID, ) (*v1.Connection, error)
GetConnection retrieves a connection by its namespace and ID.
func (*ConnectionService) ListConnections ¶ added in v0.1.1
func (s *ConnectionService) ListConnections( ctx context.Context, namespace string, opts ...ListOption, ) (*v1.ConnectionListResponse, error)
ListConnections lists connections in a namespace.
type GetOption ¶ added in v0.1.35
type GetOption interface {
Apply(settings *GetSettings)
}
GetOption is an interface for options that can be applied to get operations.
func WithGetIncludeDeleted ¶ added in v0.1.35
WithGetIncludeDeleted sets whether to include deleted resources for get operations.
type GetOptionFunc ¶ added in v0.1.35
type GetOptionFunc func(*GetSettings)
GetOptionFunc is a function type that implements the GetOption interface.
func (GetOptionFunc) Apply ¶ added in v0.1.35
func (f GetOptionFunc) Apply(opt *GetSettings)
Apply applies the GetOptionFunc to the GetSettings.
type GetSettings ¶ added in v0.1.35
type GetSettings struct {
// contains filtered or unexported fields
}
GetSettings holds the settings for getting a single resource.
type ListOption ¶ added in v0.1.18
type ListOption interface {
Apply(settings *ListSettings)
}
ListOption is an interface for options that can be applied to list operations.
func WithContinueToken ¶ added in v0.1.18
func WithContinueToken(token string) ListOption
WithContinueToken sets the continue token for pagination.
func WithIncludeDeleted ¶ added in v0.1.35
func WithIncludeDeleted(includeDeleted bool) ListOption
WithIncludeDeleted sets whether to include deleted resources.
func WithLimit ¶ added in v0.1.18
func WithLimit(limit int) ListOption
WithLimit sets the limit for the number of items to return.
type ListOptionFunc ¶ added in v0.1.18
type ListOptionFunc func(*ListSettings)
ListOptionFunc is a function type that implements the ListOption interface.
func (ListOptionFunc) Apply ¶ added in v0.1.18
func (f ListOptionFunc) Apply(opt *ListSettings)
Apply applies the ListOptionFunc to the ListSettings.
type ListSettings ¶ added in v0.1.18
type ListSettings struct {
// contains filtered or unexported fields
}
ListSettings holds the settings for listing resources.
type NamespaceListResponse ¶ added in v0.1.35
type NamespaceListResponse = v1.ListResponse[v1.Namespace]
NamespaceListResponse represents a list of namespaces with metadata.
type NamespaceService ¶ added in v0.1.35
type NamespaceService struct {
// contains filtered or unexported fields
}
NamespaceService provides methods to interact with namespaces.
func NewNamespaceService ¶ added in v0.1.35
func NewNamespaceService(service *service) *NamespaceService
NewNamespaceService creates a new NamespaceService.
func (*NamespaceService) CreateNamespace ¶ added in v0.1.35
func (s *NamespaceService) CreateNamespace( ctx context.Context, createRequest *v1.Namespace, ) (*v1.Namespace, error)
CreateNamespace creates a new namespace.
func (*NamespaceService) DeleteNamespace ¶ added in v0.1.35
func (s *NamespaceService) DeleteNamespace( ctx context.Context, name string, ) error
DeleteNamespace deletes a namespace by name.
func (*NamespaceService) GetNamespace ¶ added in v0.1.35
GetNamespace retrieves a namespace by its name.
func (*NamespaceService) ListNamespaces ¶ added in v0.1.35
func (s *NamespaceService) ListNamespaces( ctx context.Context, opts ...ListOption, ) (*NamespaceListResponse, error)
ListNamespaces lists all namespaces.
type Option ¶ added in v0.1.1
type Option interface {
Apply(client *Client)
}
Option provides a way to configure the opampcommander API client.
type OptionFunc ¶ added in v0.1.1
type OptionFunc func(*Client)
OptionFunc is a function that applies an option to the Client.
func WithBasicAuth ¶ added in v0.1.35
func WithBasicAuth(username, password string) OptionFunc
WithBasicAuth exchanges the given credentials for a JWT via /api/v1/auth/basic and configures the client to use the resulting Bearer token. If the exchange fails (e.g. server not yet ready), the client is left unauthenticated.
func WithBearerToken ¶ added in v0.1.13
func WithBearerToken(bearerToken string) OptionFunc
WithBearerToken sets the Bearer token for the client.
func WithLogger ¶ added in v0.1.10
func WithLogger(logger *slog.Logger) OptionFunc
WithLogger sets the logger for the client.
func WithVerbose ¶ added in v0.1.10
func WithVerbose(verbose bool) OptionFunc
WithVerbose enables verbose logging for the client.
func (OptionFunc) Apply ¶ added in v0.1.1
func (f OptionFunc) Apply(c *Client)
Apply applies the option to the Client.
type RBACService ¶ added in v0.1.35
type RBACService struct {
// contains filtered or unexported fields
}
RBACService provides methods to interact with RBAC.
func NewRBACService ¶ added in v0.1.35
func NewRBACService(service *service) *RBACService
NewRBACService creates a new RBACService.
func (*RBACService) CheckPermission ¶ added in v0.1.35
func (s *RBACService) CheckPermission( ctx context.Context, req *v1.CheckPermissionRequest, ) (*v1.CheckPermissionResponse, error)
CheckPermission checks whether a user has a specific permission.
func (*RBACService) GetUserPermissions ¶ added in v0.1.35
func (s *RBACService) GetUserPermissions( ctx context.Context, userID string, ) (*v1.ListResponse[v1.Permission], error)
GetUserPermissions retrieves the permissions of a user.
func (*RBACService) GetUserRoles ¶ added in v0.1.35
func (s *RBACService) GetUserRoles( ctx context.Context, userID string, ) (*v1.ListResponse[v1.Role], error)
GetUserRoles retrieves the roles assigned to a user.
func (*RBACService) SyncPolicies ¶ added in v0.1.35
func (s *RBACService) SyncPolicies(ctx context.Context) error
SyncPolicies synchronizes RBAC policies.
type ResponseError ¶
ResponseError represents an error that occurs when the response from the server is not as expected. It contains the status code of the response.
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
Error implements the error interface for ResponseError.
type RoleBindingListResponse ¶ added in v0.1.35
type RoleBindingListResponse = v1.ListResponse[v1.RoleBinding]
RoleBindingListResponse represents a list of role bindings with metadata.
type RoleBindingService ¶ added in v0.1.35
type RoleBindingService struct {
// contains filtered or unexported fields
}
RoleBindingService provides methods to interact with role bindings.
func NewRoleBindingService ¶ added in v0.1.35
func NewRoleBindingService(service *service) *RoleBindingService
NewRoleBindingService creates a new RoleBindingService.
func (*RoleBindingService) CreateRoleBinding ¶ added in v0.1.35
func (s *RoleBindingService) CreateRoleBinding( ctx context.Context, namespace string, createRequest *v1.RoleBinding, ) (*v1.RoleBinding, error)
CreateRoleBinding creates a new role binding.
func (*RoleBindingService) DeleteRoleBinding ¶ added in v0.1.35
func (s *RoleBindingService) DeleteRoleBinding(ctx context.Context, namespace string, name string) error
DeleteRoleBinding deletes a role binding by its namespace and name.
func (*RoleBindingService) GetRoleBinding ¶ added in v0.1.35
func (s *RoleBindingService) GetRoleBinding( ctx context.Context, namespace string, name string, ) (*v1.RoleBinding, error)
GetRoleBinding retrieves a role binding by its namespace and name.
func (*RoleBindingService) ListRoleBindings ¶ added in v0.1.35
func (s *RoleBindingService) ListRoleBindings( ctx context.Context, namespace string, opts ...ListOption, ) (*RoleBindingListResponse, error)
ListRoleBindings lists all role bindings in a namespace.
func (*RoleBindingService) UpdateRoleBinding ¶ added in v0.1.35
func (s *RoleBindingService) UpdateRoleBinding( ctx context.Context, updateRequest *v1.RoleBinding, ) (*v1.RoleBinding, error)
UpdateRoleBinding updates an existing role binding.
type RoleListResponse ¶ added in v0.1.35
type RoleListResponse = v1.ListResponse[v1.Role]
RoleListResponse represents a list of roles with metadata.
type RoleService ¶ added in v0.1.35
type RoleService struct {
// contains filtered or unexported fields
}
RoleService provides methods to interact with roles.
func NewRoleService ¶ added in v0.1.35
func NewRoleService(service *service) *RoleService
NewRoleService creates a new RoleService.
func (*RoleService) CreateRole ¶ added in v0.1.35
CreateRole creates a new role.
func (*RoleService) DeleteRole ¶ added in v0.1.35
func (s *RoleService) DeleteRole(ctx context.Context, uid string) error
DeleteRole deletes a role by its UID.
func (*RoleService) ListRoles ¶ added in v0.1.35
func (s *RoleService) ListRoles( ctx context.Context, opts ...ListOption, ) (*RoleListResponse, error)
ListRoles lists all roles.
type SetNewInstanceUIDRequest ¶ added in v0.1.27
type SetNewInstanceUIDRequest struct {
NewInstanceUID uuid.UUID `binding:"required" json:"newInstanceUid"`
}
SetNewInstanceUIDRequest is a struct that represents the request to set a new instance UID for the agent.
type UserListResponse ¶ added in v0.1.35
type UserListResponse = v1.ListResponse[v1.User]
UserListResponse represents a list of users with metadata.
type UserService ¶ added in v0.1.35
type UserService struct {
// contains filtered or unexported fields
}
UserService provides methods to interact with users.
func NewUserService ¶ added in v0.1.35
func NewUserService(service *service) *UserService
NewUserService creates a new UserService.
func (*UserService) CreateUser ¶ added in v0.1.35
CreateUser creates a new user.
func (*UserService) DeleteUser ¶ added in v0.1.35
func (s *UserService) DeleteUser(ctx context.Context, uid string) error
DeleteUser deletes a user by its UID.
func (*UserService) GetMyProfile ¶ added in v0.1.35
func (s *UserService) GetMyProfile(ctx context.Context) (*v1.UserProfileResponse, error)
GetMyProfile retrieves the current user's profile with roles and permissions.
func (*UserService) ListUsers ¶ added in v0.1.35
func (s *UserService) ListUsers( ctx context.Context, opts ...ListOption, ) (*UserListResponse, error)
ListUsers lists all users.