Documentation
¶
Overview ¶
Package vast_client provides a typed and convenient interface to interact with the VAST Data REST API.
It wraps raw HTTP operations in a structured API, exposing high-level methods to manage VAST resources like views, volumes, quotas, snapshots, and more. Each resource is available as a sub-client that supports common CRUD operations (List, Get, GetById, Create, Update, Delete, etc.).
The main entry point is the VMSRest client, which is initialized using a VMSConfig configuration struct. This configuration allows customization of connection parameters, credentials (username/password or token), SSL behavior, request timeouts, and request/response hooks.
Index ¶
- Constants
- func ClientVersion() string
- func ExpectStatusCodes(err error, codes ...int) bool
- func IgnoreStatusCodes(err error, codes ...int) error
- func IsApiError(err error) bool
- func IsNotFoundErr(err error) bool
- type ActiveDirectory
- type ApiError
- type ApiRTokenAuthenticator
- type ApiToken
- type AsyncResult
- type Authenticator
- type Awaitable
- type BGPConfig
- type BlockHost
- type BlockHostMapping
- func (bhm *BlockHostMapping) EnsureMap(hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) EnsureMapWithContext(ctx context.Context, hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) EnsureUnmap(hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) EnsureUnmapWithContext(ctx context.Context, hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) Map(hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) MapWithContext(ctx context.Context, hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) UnMap(hostId, volumeId int64) (Record, error)
- func (bhm *BlockHostMapping) UnMapWithContext(ctx context.Context, hostId, volumeId int64) (Record, error)
- type Cnode
- type DisplayableRecord
- type Dns
- type Dummy
- type EmptyRecord
- type EncryptionGroup
- func (eg *EncryptionGroup) DeactivateEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) DeactivateEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) ReinstateEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) ReinstateEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) RevokeEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) RevokeEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) RotateEncryptionGroupKey(encryptionGroupId any) (EmptyRecord, error)
- func (eg *EncryptionGroup) RotateEncryptionGroupKeyWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
- type EventDefinition
- type EventDefinitionConfig
- type FillFunc
- type Filler
- type Folder
- func (f *Folder) CreateFolder(data Params) (Record, error)
- func (f *Folder) CreateFolderWithContext(ctx context.Context, data Params) (Record, error)
- func (f *Folder) DeleteFolder(data Params) (EmptyRecord, error)
- func (f *Folder) DeleteFolderWithContext(ctx context.Context, data Params) (EmptyRecord, error)
- func (f *Folder) DeleteReadOnly(data Params) (EmptyRecord, error)
- func (f *Folder) DeleteReadOnlyWithContext(ctx context.Context, data Params) (EmptyRecord, error)
- func (f *Folder) GetReadOnly(params Params) (Record, error)
- func (f *Folder) GetReadOnlyWithContext(ctx context.Context, params Params) (Record, error)
- func (f *Folder) ModifyFolder(data Params) (Record, error)
- func (f *Folder) ModifyFolderWithContext(ctx context.Context, data Params) (Record, error)
- func (f *Folder) SetReadOnly(data Params) (Record, error)
- func (f *Folder) SetReadOnlyWithContext(ctx context.Context, data Params) (Record, error)
- func (f *Folder) StatPath(data Params) (Record, error)
- func (f *Folder) StatPathWithContext(ctx context.Context, data Params) (Record, error)
- type GlobalSnapshotStream
- func (gss *GlobalSnapshotStream) CloneSnapshot(snapId int64, createParams Params) (Record, error)
- func (gss *GlobalSnapshotStream) CloneSnapshotWithContext(ctx context.Context, snapId int64, createParams Params) (Record, error)
- func (gss *GlobalSnapshotStream) EnsureCloneSnapshot(name string, snapId int64, createParams Params) (Record, error)
- func (gss *GlobalSnapshotStream) EnsureCloneSnapshotDeleted(searchParams Params) (Renderable, error)
- func (gss *GlobalSnapshotStream) EnsureCloneSnapshotDeletedWithContext(ctx context.Context, searchParams Params) (Renderable, error)
- func (gss *GlobalSnapshotStream) EnsureCloneSnapshotWithContext(ctx context.Context, name string, snapId int64, createParams Params) (Record, error)
- func (gss *GlobalSnapshotStream) StopCloneSnapshot(gssId int64) (Awaitable, error)
- func (gss *GlobalSnapshotStream) StopCloneSnapshotWithContext(ctx context.Context, gssId int64) (Awaitable, error)
- type Group
- type InterceptableVastResourceAPI
- type JWTAuthenticator
- type KafkaBroker
- type KeyLocker
- type Ldap
- type LocalProvider
- type LocalS3Key
- type Manager
- type Nis
- type NonLocalGroup
- type NonLocalUser
- type NonLocalUserKey
- type NotFoundError
- type OpenAPI
- type Params
- type ProtectedPath
- type ProtectionPolicy
- type QosPolicy
- type Quota
- type RESTSession
- type Realm
- type Record
- func (r Record) Fill(container any) error
- func (r Record) PrettyJson(indent ...string) string
- func (r Record) PrettyTable() string
- func (r Record) RecordGUID() string
- func (r Record) RecordID() int64
- func (r Record) RecordName() string
- func (r Record) RecordTenantID() int64
- func (r Record) RecordTenantName() string
- func (r Record) SetMissingValue(key string, value any)
- func (r Record) String() string
- type RecordSet
- type RecordUnion
- type Renderable
- type ReplicationPeers
- type RequestInterceptor
- type Role
- type S3LifeCycleRule
- type S3Policy
- type S3replicationPeers
- type SamlConfig
- func (sc *SamlConfig) DeleteConfig(vmsId any, idpName string) (EmptyRecord, error)
- func (sc *SamlConfig) DeleteConfigWithContext(ctx context.Context, vmsId any, idpName string) (EmptyRecord, error)
- func (sc *SamlConfig) GetConfig(vmsId any, idpName string) (Record, error)
- func (sc *SamlConfig) GetConfigWithContext(ctx context.Context, vmsId any, idpName string) (Record, error)
- func (sc *SamlConfig) RemoveSignedCert(vmsId any, idpName string) (EmptyRecord, error)
- func (sc *SamlConfig) RemoveSignedCertWithContext(ctx context.Context, vmsId any, idpName string) (EmptyRecord, error)
- func (sc *SamlConfig) UpdateConfig(vmsId any, idpName string, params Params) (Record, error)
- func (sc *SamlConfig) UpdateConfigWithContext(ctx context.Context, vmsId any, idpName string, params Params) (Record, error)
- type Snapshot
- type Tenant
- func (t *Tenant) DeactivateEncryptionGroup(tenantId any) (EmptyRecord, error)
- func (t *Tenant) DeactivateEncryptionGroupWithContext(ctx context.Context, tenantId any) (EmptyRecord, error)
- func (t *Tenant) GetClientMetrics(tenantId any) (Record, error)
- func (t *Tenant) GetClientMetricsWithContext(ctx context.Context, tenantId any) (Record, error)
- func (t *Tenant) GetConfiguredIdP(tenantName string) (Record, error)
- func (t *Tenant) GetConfiguredIdPWithContext(ctx context.Context, tenantName string) (Record, error)
- func (t *Tenant) ReinstateEncryptionGroup(tenantId any) (EmptyRecord, error)
- func (t *Tenant) ReinstateEncryptionGroupWithContext(ctx context.Context, tenantId any) (EmptyRecord, error)
- func (t *Tenant) RevokeEncryptionGroup(tenantId any) (EmptyRecord, error)
- func (t *Tenant) RevokeEncryptionGroupWithContext(ctx context.Context, tenantId any) (EmptyRecord, error)
- func (t *Tenant) RotateEncryptionGroupKey(tenantId any) (EmptyRecord, error)
- func (t *Tenant) RotateEncryptionGroupKeyWithContext(ctx context.Context, tenantId any) (EmptyRecord, error)
- func (t *Tenant) UpdateClientMetrics(tenantId any, params Params) (Record, error)
- func (t *Tenant) UpdateClientMetricsWithContext(ctx context.Context, tenantId any, params Params) (Record, error)
- type TooManyRecordsError
- type Topic
- func (t *Topic) DeleteTopic(params Params) (EmptyRecord, error)
- func (t *Topic) DeleteTopicWithContext(ctx context.Context, params Params) (EmptyRecord, error)
- func (t *Topic) ShowTopic(params Params) (Record, error)
- func (t *Topic) ShowTopicWithContext(ctx context.Context, params Params) (Record, error)
- type User
- func (u *User) Copy(params UsersCopyParams) error
- func (u *User) CopyWithContext(ctx context.Context, params UsersCopyParams) error
- func (u *User) GetTenantData(userId any) (Record, error)
- func (u *User) GetTenantDataWithContext(ctx context.Context, userId any) (Record, error)
- func (u *User) UpdateTenantData(userId any, params Params) (Record, error)
- func (u *User) UpdateTenantDataWithContext(ctx context.Context, userId any, params Params) (Record, error)
- type UserKey
- func (uk *UserKey) CreateKey(userId int64) (Record, error)
- func (uk *UserKey) CreateKeyWithContext(ctx context.Context, userId int64) (Record, error)
- func (uk *UserKey) DeleteKey(userId int64, accessKey string) (EmptyRecord, error)
- func (uk *UserKey) DeleteKeyWithContext(ctx context.Context, userId int64, accessKey string) (EmptyRecord, error)
- func (uk *UserKey) DisableKey(userId int64, accessKey string) (EmptyRecord, error)
- func (uk *UserKey) DisableKeyWithContext(ctx context.Context, userId int64, accessKey string) (EmptyRecord, error)
- func (uk *UserKey) EnableKey(userId int64, accessKey string) (EmptyRecord, error)
- func (uk *UserKey) EnableKeyWithContext(ctx context.Context, userId int64, accessKey string) (EmptyRecord, error)
- type UsersCopyParams
- type VMSConfig
- type VMSConfigFunc
- type VMSRest
- type VMSSession
- func (s *VMSSession) Delete(ctx context.Context, url string, body Params) (Renderable, error)
- func (s *VMSSession) Get(ctx context.Context, url string, _ Params) (Renderable, error)
- func (s *VMSSession) GetAuthenticator() Authenticator
- func (s *VMSSession) GetConfig() *VMSConfig
- func (s *VMSSession) Patch(ctx context.Context, url string, body Params) (Renderable, error)
- func (s *VMSSession) Post(ctx context.Context, url string, body Params) (Renderable, error)
- func (s *VMSSession) Put(ctx context.Context, url string, body Params) (Renderable, error)
- type VMSSessionMethod
- type VTask
- type VastResource
- func (e *VastResource) Create(params Params) (Record, error)
- func (e *VastResource) CreateWithContext(ctx context.Context, body Params) (Record, error)
- func (e *VastResource) Delete(searchParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) DeleteById(id any, queryParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) DeleteByIdWithContext(ctx context.Context, id any, queryParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) DeleteNonId(queryParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) DeleteNonIdWithContext(ctx context.Context, queryParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) DeleteWithContext(ctx context.Context, searchParams, queryParams, deleteParams Params) (EmptyRecord, error)
- func (e *VastResource) Ensure(searchParams, body Params) (Record, error)
- func (e *VastResource) EnsureByName(name string, body Params) (Record, error)
- func (e *VastResource) EnsureByNameWithContext(ctx context.Context, name string, body Params) (Record, error)
- func (e *VastResource) EnsureWithContext(ctx context.Context, searchParams Params, body Params) (Record, error)
- func (e *VastResource) Exists(params Params) (bool, error)
- func (e *VastResource) ExistsWithContext(ctx context.Context, params Params) (bool, error)
- func (e *VastResource) Get(params Params) (Record, error)
- func (e *VastResource) GetById(id any) (Record, error)
- func (e *VastResource) GetByIdWithContext(ctx context.Context, id any) (Record, error)
- func (e *VastResource) GetResourcePath() string
- func (e *VastResource) GetResourceType() string
- func (e *VastResource) GetWithContext(ctx context.Context, params Params) (Record, error)
- func (e *VastResource) List(params Params) (RecordSet, error)
- func (e *VastResource) ListWithContext(ctx context.Context, params Params) (RecordSet, error)
- func (e *VastResource) Lock(keys ...any) func()
- func (e *VastResource) MustExists(params Params) bool
- func (e *VastResource) MustExistsWithContext(ctx context.Context, params Params) bool
- func (e *VastResource) Session() RESTSession
- func (e *VastResource) Update(id any, params Params) (Record, error)
- func (e *VastResource) UpdateNonId(params Params) (Record, error)
- func (e *VastResource) UpdateNonIdWithContext(ctx context.Context, body Params) (Record, error)
- func (e *VastResource) UpdateWithContext(ctx context.Context, id any, body Params) (Record, error)
- type VastResourceAPI
- type VastResourceAPIWithContext
- type VastResourceType
- type Version
- func (v *Version) CompareWith(other *version.Version) (int, error)
- func (v *Version) CompareWithWithContext(ctx context.Context, other *version.Version) (int, error)
- func (v *Version) GetVersion() (*version.Version, error)
- func (v *Version) GetVersionWithContext(ctx context.Context) (*version.Version, error)
- type View
- type ViewPolicy
- type VipPool
- type Vms
- func (v *Vms) GetConfiguredIdPs(vmsId any) ([]string, error)
- func (v *Vms) GetConfiguredIdPsWithContext(ctx context.Context, vmsId any) ([]string, error)
- func (v *Vms) SetMaxApiTokensPerUser(vmsId int64, tokensCount int64) (EmptyRecord, error)
- func (v *Vms) SetMaxApiTokensPerUserWithContext(ctx context.Context, vmsId int64, tokensCount int64) (EmptyRecord, error)
- type Volume
Constants ¶
const ApplicationJson = "application/json"
Variables ¶
This section is empty.
Functions ¶
func ClientVersion ¶
func ClientVersion() string
func ExpectStatusCodes ¶ added in v0.7.0
func IgnoreStatusCodes ¶ added in v0.5.0
func IsApiError ¶
func IsNotFoundErr ¶
Types ¶
type ActiveDirectory ¶
type ActiveDirectory struct {
*VastResource
}
type ApiRTokenAuthenticator ¶
type ApiToken ¶
type ApiToken struct {
*VastResource
}
func (*ApiToken) Revoke ¶ added in v0.32.0
func (a *ApiToken) Revoke(tokenId string) (EmptyRecord, error)
func (*ApiToken) RevokeWithContext ¶ added in v0.32.0
type AsyncResult ¶
type AsyncResult struct { TaskId int64 // contains filtered or unexported fields }
AsyncResult represents the result of an asynchronous task. It contains the task's ID and necessary context for waiting on the task to complete.
func (*AsyncResult) Wait ¶
func (ar *AsyncResult) Wait(timeout time.Duration) (Record, error)
Wait blocks until the asynchronous task completes and returns the resulting Record. If the context (ar.ctx) is not set, it falls back to the context from the associated rest client.
func (*AsyncResult) WaitWithContext ¶
func (ar *AsyncResult) WaitWithContext(ctx context.Context) (Record, error)
WaitWithContext blocks until the asynchronous task completes or the provided context is canceled. It delegates to the VTasks.WaitTaskWithContext method of the rest client to poll for task completion.
type Authenticator ¶
type Authenticator interface {
// contains filtered or unexported methods
}
type BGPConfig ¶ added in v0.28.0
type BGPConfig struct {
*VastResource
}
type BlockHostMapping ¶
type BlockHostMapping struct {
*VastResource
}
func (*BlockHostMapping) EnsureMap ¶
func (bhm *BlockHostMapping) EnsureMap(hostId, volumeId int64) (Record, error)
func (*BlockHostMapping) EnsureMapWithContext ¶
func (*BlockHostMapping) EnsureUnmap ¶
func (bhm *BlockHostMapping) EnsureUnmap(hostId, volumeId int64) (Record, error)
func (*BlockHostMapping) EnsureUnmapWithContext ¶
func (*BlockHostMapping) Map ¶
func (bhm *BlockHostMapping) Map(hostId, volumeId int64) (Record, error)
func (*BlockHostMapping) MapWithContext ¶
func (*BlockHostMapping) UnMap ¶
func (bhm *BlockHostMapping) UnMap(hostId, volumeId int64) (Record, error)
func (*BlockHostMapping) UnMapWithContext ¶
type Cnode ¶
type Cnode struct {
*VastResource
}
type DisplayableRecord ¶ added in v0.4.0
type DisplayableRecord interface { Renderable Filler }
DisplayableRecord defines a unified interface for working with structured data that has been deserialized from an API response. It combines both rendering and data population capabilities.
Implementing types must support:
- Rendering themselves as human-readable output via the Renderable interface.
- Filling provided container structs or slices using the Filler interface.
This interface is implemented by Record, RecordSet, and EmptyRecord, allowing generic handling of different response shapes (single item, list, or empty).
type Dns ¶
type Dns struct {
*VastResource
}
type Dummy ¶
type Dummy struct {
*VastResource
}
type EmptyRecord ¶
EmptyRecord represents a placeholder for methods that do not return data, such as DELETE operations. It maintains the same structure as Record but is used semantically to indicate the absence of returned content.
func (EmptyRecord) Fill ¶ added in v0.4.0
func (er EmptyRecord) Fill(_ any) error
func (EmptyRecord) PrettyJson ¶
func (er EmptyRecord) PrettyJson(indent ...string) string
func (EmptyRecord) String ¶
func (er EmptyRecord) String() string
type EncryptionGroup ¶ added in v0.37.0
type EncryptionGroup struct {
*VastResource
}
func (*EncryptionGroup) DeactivateEncryptionGroup ¶ added in v0.37.0
func (eg *EncryptionGroup) DeactivateEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) DeactivateEncryptionGroupWithContext ¶ added in v0.37.0
func (eg *EncryptionGroup) DeactivateEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) ReinstateEncryptionGroup ¶ added in v0.37.0
func (eg *EncryptionGroup) ReinstateEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) ReinstateEncryptionGroupWithContext ¶ added in v0.37.0
func (eg *EncryptionGroup) ReinstateEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) RevokeEncryptionGroup ¶ added in v0.37.0
func (eg *EncryptionGroup) RevokeEncryptionGroup(encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) RevokeEncryptionGroupWithContext ¶ added in v0.37.0
func (eg *EncryptionGroup) RevokeEncryptionGroupWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) RotateEncryptionGroupKey ¶ added in v0.37.0
func (eg *EncryptionGroup) RotateEncryptionGroupKey(encryptionGroupId any) (EmptyRecord, error)
func (*EncryptionGroup) RotateEncryptionGroupKeyWithContext ¶ added in v0.37.0
func (eg *EncryptionGroup) RotateEncryptionGroupKeyWithContext(ctx context.Context, encryptionGroupId any) (EmptyRecord, error)
type EventDefinition ¶ added in v0.26.0
type EventDefinition struct {
*VastResource
}
type EventDefinitionConfig ¶ added in v0.26.0
type EventDefinitionConfig struct {
*VastResource
}
type Filler ¶ added in v0.4.0
type Filler interface { // Fill populates the given container with data from the implementing type. // The container can be a pointer to a struct (for Record), // or a pointer to a slice of structs (for RecordSet). Fill(container any) error }
Filler is a generic interface for filling a struct or slice of structs.
type Folder ¶ added in v0.20.0
type Folder struct {
*VastResource
}
func (*Folder) CreateFolder ¶ added in v0.27.0
func (*Folder) CreateFolderWithContext ¶ added in v0.27.0
func (*Folder) DeleteFolder ¶ added in v0.20.0
func (f *Folder) DeleteFolder(data Params) (EmptyRecord, error)
func (*Folder) DeleteFolderWithContext ¶ added in v0.20.0
func (*Folder) DeleteReadOnly ¶ added in v0.27.0
func (f *Folder) DeleteReadOnly(data Params) (EmptyRecord, error)
func (*Folder) DeleteReadOnlyWithContext ¶ added in v0.27.0
func (*Folder) GetReadOnly ¶ added in v0.27.0
func (*Folder) GetReadOnlyWithContext ¶ added in v0.27.0
func (*Folder) ModifyFolder ¶ added in v0.27.0
func (*Folder) ModifyFolderWithContext ¶ added in v0.27.0
func (*Folder) SetReadOnly ¶ added in v0.27.0
func (*Folder) SetReadOnlyWithContext ¶ added in v0.27.0
type GlobalSnapshotStream ¶
type GlobalSnapshotStream struct {
*VastResource
}
func (*GlobalSnapshotStream) CloneSnapshot ¶ added in v0.12.0
func (gss *GlobalSnapshotStream) CloneSnapshot(snapId int64, createParams Params) (Record, error)
func (*GlobalSnapshotStream) CloneSnapshotWithContext ¶ added in v0.12.0
func (*GlobalSnapshotStream) EnsureCloneSnapshot ¶ added in v0.12.0
func (*GlobalSnapshotStream) EnsureCloneSnapshotDeleted ¶ added in v0.12.0
func (gss *GlobalSnapshotStream) EnsureCloneSnapshotDeleted(searchParams Params) (Renderable, error)
func (*GlobalSnapshotStream) EnsureCloneSnapshotDeletedWithContext ¶ added in v0.12.0
func (gss *GlobalSnapshotStream) EnsureCloneSnapshotDeletedWithContext(ctx context.Context, searchParams Params) (Renderable, error)
func (*GlobalSnapshotStream) EnsureCloneSnapshotWithContext ¶ added in v0.12.0
func (*GlobalSnapshotStream) StopCloneSnapshot ¶ added in v0.12.0
func (gss *GlobalSnapshotStream) StopCloneSnapshot(gssId int64) (Awaitable, error)
func (*GlobalSnapshotStream) StopCloneSnapshotWithContext ¶ added in v0.12.0
type Group ¶
type Group struct {
*VastResource
}
type InterceptableVastResourceAPI ¶ added in v0.3.0
type InterceptableVastResourceAPI interface { RequestInterceptor VastResourceAPIWithContext }
InterceptableVastResourceAPI combines request interception with vast resource behavior.
type JWTAuthenticator ¶
type KafkaBroker ¶ added in v0.2.0
type KafkaBroker struct {
*VastResource
}
type KeyLocker ¶ added in v0.13.0
type KeyLocker struct {
// contains filtered or unexported fields
}
func NewKeyLocker ¶ added in v0.13.0
func NewKeyLocker() *KeyLocker
NewKeyLocker creates a new KeyLocker.
type Ldap ¶
type Ldap struct {
*VastResource
}
type LocalProvider ¶ added in v0.35.0
type LocalProvider struct {
*VastResource
}
type LocalS3Key ¶ added in v0.35.0
type LocalS3Key struct {
*VastResource
}
type Manager ¶ added in v0.10.0
type Manager struct {
*VastResource
}
type Nis ¶
type Nis struct {
*VastResource
}
type NonLocalGroup ¶
type NonLocalGroup struct {
*VastResource
}
func (*NonLocalGroup) UpdateNonLocalGroup ¶ added in v0.11.0
func (g *NonLocalGroup) UpdateNonLocalGroup(data Params) (Record, error)
func (*NonLocalGroup) UpdateNonLocalGroupWithContext ¶ added in v0.11.0
type NonLocalUser ¶
type NonLocalUser struct {
*VastResource
}
func (*NonLocalUser) UpdateNonLocalUser ¶ added in v0.11.0
func (u *NonLocalUser) UpdateNonLocalUser(data Params) (Record, error)
func (*NonLocalUser) UpdateNonLocalUserWithContext ¶ added in v0.11.0
type NonLocalUserKey ¶ added in v0.11.0
type NonLocalUserKey struct {
*VastResource
}
type NotFoundError ¶
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type OpenAPI ¶ added in v0.5.0
type OpenAPI struct {
// contains filtered or unexported fields
}
func (*OpenAPI) FetchSchemaV2 ¶ added in v0.6.0
FetchSchemaV2 retrieves the Swagger 2.0 (OpenAPI v2) schema from the remote VAST backend.
It performs an authenticated request to the OpenAPI schema endpoint and attempts to unmarshal the returned JSON into a structured `openapi2.T` object, which includes metadata about the API, available paths, definitions (models), parameters, responses, and security schemes.
The returned object follows the OpenAPI 2.0 specification, with fields like:
- Swagger: version (must be "2.0")
- Info: API title, version, contact, and license
- Host: API hostname (e.g. "domain.com")
- BasePath: base path for endpoints (e.g. "/api")
- Paths: map of endpoint paths and operations
- Definitions: schema definitions for reusable data structures
- Parameters, Responses, SecurityDefinitions, etc.
Returns:
*openapi2.T: structured representation of the OpenAPI 2.0 document error: if fetching or unmarshalling fails
Example usage:
schema, err := client.FetchSchema(ctx) if err != nil { log.Fatalf("error loading OpenAPI schema: %v", err) } fmt.Println(schema.Paths["/users/"].Get.Summary)
func (*OpenAPI) FetchSchemaV3 ¶ added in v0.6.0
FetchSchemaV3 retrieves the OpenAPI v3.0 schema for the VAST backend by first fetching the Swagger 2.0 (OpenAPI v2) document and converting it to v3 format.
This function is useful when working with tools or generators (e.g., Terraform schema generators) that expect OpenAPI 3.0-compliant schemas.
The returned OpenAPI v3 document includes:
- Components: schemas, responses, parameters, etc.
- Paths: endpoint definitions
- Info: metadata about the API
Returns:
*openapi3.T: the converted OpenAPI v3 schema error: if either fetching the v2 schema or converting to v3 fails
Example:
doc, err := client.OpenAPI.FetchSchemaV3(ctx) if err != nil { log.Fatalf("failed to fetch schema: %v", err) } fmt.Println(doc.Components.Schemas["User"].Value.Type)
type Params ¶
Params represents a generic set of key-value parameters, used for constructing query strings or request bodies.
func (*Params) ToBody ¶
ToBody serializes the Params into a JSON-encoded io.Reader, suitable for use as the body of an HTTP POST, PUT, or PATCH request.
func (*Params) ToQuery ¶
ToQuery serializes the Params into a URL-encoded query string. This is useful for GET requests where parameters are passed via the URL.
func (*Params) Update ¶
Update merges another Params map into the original Params. If a key already exists and `override` is true, its value is skipped. If a key doesn't exist, the key-value pair is added.
func (*Params) UpdateWithout ¶
UpdateWithout merges another Params map into the original Params. If a key exists in the `without` slice, it is skipped. If a key already exists and `override` is false, its value is also skipped. Otherwise, the key-value pair is added or updated based on the `override` flag.
type ProtectedPath ¶
type ProtectedPath struct {
*VastResource
}
type ProtectionPolicy ¶
type ProtectionPolicy struct {
*VastResource
}
type QosPolicy ¶
type QosPolicy struct {
*VastResource
}
type Quota ¶
type Quota struct {
*VastResource
}
type RESTSession ¶
type RESTSession interface { Get(context.Context, string, Params) (Renderable, error) Post(context.Context, string, Params) (Renderable, error) Put(context.Context, string, Params) (Renderable, error) Patch(context.Context, string, Params) (Renderable, error) Delete(context.Context, string, Params) (Renderable, error) GetConfig() *VMSConfig GetAuthenticator() Authenticator }
type Realm ¶
type Realm struct {
*VastResource
}
type Record ¶
Record represents a single generic data object as a key-value map. It's commonly used to unmarshal a single JSON object from an API response.
func (Record) Fill ¶
Fill populates the exported fields of the given struct pointer using values from the Record (a map[string]any). It uses JSON marshaling and unmarshaling to automatically map keys to struct fields based on their `json` tags and perform type conversions where needed.
The target container must be a non-nil pointer to a struct. Fields in the struct must be exported (i.e., start with an uppercase letter) and optionally tagged with `json` to match keys in the Record.
JSON-based conversion handles common type mismatches (e.g., string to int, int to string) and nested structures if compatible.
Returns an error if the container is not a pointer to a struct or if serialization fails.
func (Record) PrettyJson ¶
PrettyJson prints the Record as JSON, optionally indented
func (Record) PrettyTable ¶
PrettyTable prints a single Record as a table
func (Record) RecordGUID ¶ added in v0.3.0
RecordGUID returns the name of the record as a string. It looks up the "name" field in the record map.
func (Record) RecordID ¶
RecordID returns the ID of the record as an int64. It looks up the "id" field in the record map.
func (Record) RecordName ¶
RecordName returns the name of the record as a string. It looks up the "name" field in the record map.
func (Record) RecordTenantID ¶
RecordTenantID returns the tenant's ID as an int64. It looks up the "id" field in the record map.
func (Record) RecordTenantName ¶
RecordTenantName returns the name of the tenant as a string. It looks up the "tenant_name" field in the record map.
func (Record) SetMissingValue ¶ added in v0.4.0
SetMissingValue If the key is not present in the Record, set it to the provided value
type RecordSet ¶
type RecordSet []Record
RecordSet represents a list of Record objects. It is typically used to represent responses containing multiple items.
func (RecordSet) Fill ¶ added in v0.4.0
Fill populates the provided container slice with data from the RecordSet. The container must be a non-nil pointer to a slice of structs. Each Record in the RecordSet is individually marshaled into an element of the slice using JSON serialization, and appended to the resulting slice.
Example usage:
var users []User err := recordSet.Fill(&users) if err != nil { // handle error }
Parameters:
- container: must be a pointer to a slice of structs (e.g., *[]T or *[]*T).
Returns an error if:
- The container is not a non-nil pointer to a slice.
- The slice element type is not a struct.
- Any Record in the RecordSet fails to unmarshal into an element.
func (RecordSet) PrettyJson ¶
PrettyJson prints the Record as JSON, optionally indented
func (RecordSet) PrettyTable ¶
PrettyTable prints the full RecordSet by rendering each individual Record
type RecordUnion ¶
type RecordUnion interface { Record | EmptyRecord | RecordSet }
RecordUnion defines a union of supported record types for generic operations. It can be a single Record, an EmptyRecord, or a RecordSet. This allows functions to operate on any supported response type using Go generics.
type Renderable ¶
Renderable is an interface implemented by types that can render themselves into a human-readable string format, typically for CLI display or logging.
type ReplicationPeers ¶
type ReplicationPeers struct {
*VastResource
}
type RequestInterceptor ¶
type RequestInterceptor interface {
// contains filtered or unexported methods
}
RequestInterceptor defines a middleware-style interface for intercepting API requests and responses in client-server interactions. It allows implementing logic that runs before sending a request and after receiving a response. Typical use cases include logging, request mutation, authentication, and response transformation.
type Role ¶
type Role struct {
*VastResource
}
type S3LifeCycleRule ¶
type S3LifeCycleRule struct {
*VastResource
}
type S3Policy ¶
type S3Policy struct {
*VastResource
}
type S3replicationPeers ¶
type S3replicationPeers struct {
*VastResource
}
type SamlConfig ¶ added in v0.40.0
type SamlConfig struct {
*VastResource
}
func (*SamlConfig) DeleteConfig ¶ added in v0.40.0
func (sc *SamlConfig) DeleteConfig(vmsId any, idpName string) (EmptyRecord, error)
func (*SamlConfig) DeleteConfigWithContext ¶ added in v0.40.0
func (sc *SamlConfig) DeleteConfigWithContext(ctx context.Context, vmsId any, idpName string) (EmptyRecord, error)
func (*SamlConfig) GetConfig ¶ added in v0.40.0
func (sc *SamlConfig) GetConfig(vmsId any, idpName string) (Record, error)
func (*SamlConfig) GetConfigWithContext ¶ added in v0.40.0
func (*SamlConfig) RemoveSignedCert ¶ added in v0.40.0
func (sc *SamlConfig) RemoveSignedCert(vmsId any, idpName string) (EmptyRecord, error)
func (*SamlConfig) RemoveSignedCertWithContext ¶ added in v0.40.0
func (sc *SamlConfig) RemoveSignedCertWithContext(ctx context.Context, vmsId any, idpName string) (EmptyRecord, error)
func (*SamlConfig) UpdateConfig ¶ added in v0.40.0
func (*SamlConfig) UpdateConfigWithContext ¶ added in v0.40.0
type Snapshot ¶
type Snapshot struct {
*VastResource
}
type Tenant ¶
type Tenant struct {
*VastResource
}
func (*Tenant) DeactivateEncryptionGroup ¶ added in v0.38.0
func (t *Tenant) DeactivateEncryptionGroup(tenantId any) (EmptyRecord, error)
func (*Tenant) DeactivateEncryptionGroupWithContext ¶ added in v0.38.0
func (*Tenant) GetClientMetrics ¶ added in v0.39.0
func (*Tenant) GetClientMetricsWithContext ¶ added in v0.39.0
func (*Tenant) GetConfiguredIdP ¶ added in v0.39.0
func (*Tenant) GetConfiguredIdPWithContext ¶ added in v0.39.0
func (*Tenant) ReinstateEncryptionGroup ¶ added in v0.38.0
func (t *Tenant) ReinstateEncryptionGroup(tenantId any) (EmptyRecord, error)
func (*Tenant) ReinstateEncryptionGroupWithContext ¶ added in v0.38.0
func (*Tenant) RevokeEncryptionGroup ¶ added in v0.38.0
func (t *Tenant) RevokeEncryptionGroup(tenantId any) (EmptyRecord, error)
func (*Tenant) RevokeEncryptionGroupWithContext ¶ added in v0.38.0
func (*Tenant) RotateEncryptionGroupKey ¶ added in v0.38.0
func (t *Tenant) RotateEncryptionGroupKey(tenantId any) (EmptyRecord, error)
func (*Tenant) RotateEncryptionGroupKeyWithContext ¶ added in v0.38.0
func (*Tenant) UpdateClientMetrics ¶ added in v0.39.0
type TooManyRecordsError ¶
func (*TooManyRecordsError) Error ¶
func (e *TooManyRecordsError) Error() string
Implement the Error method to satisfy the error interface
type Topic ¶ added in v0.35.0
type Topic struct {
*VastResource
}
func (*Topic) DeleteTopic ¶ added in v0.41.0
func (t *Topic) DeleteTopic(params Params) (EmptyRecord, error)
func (*Topic) DeleteTopicWithContext ¶ added in v0.41.0
type User ¶
type User struct {
*VastResource
}
func (*User) Copy ¶ added in v0.35.0
func (u *User) Copy(params UsersCopyParams) error
func (*User) CopyWithContext ¶ added in v0.35.0
func (u *User) CopyWithContext(ctx context.Context, params UsersCopyParams) error
func (*User) GetTenantData ¶ added in v0.36.0
func (*User) GetTenantDataWithContext ¶ added in v0.36.0
func (*User) UpdateTenantData ¶ added in v0.36.0
type UserKey ¶
type UserKey struct {
*VastResource
}
func (*UserKey) CreateKeyWithContext ¶
func (*UserKey) DeleteKey ¶
func (uk *UserKey) DeleteKey(userId int64, accessKey string) (EmptyRecord, error)
func (*UserKey) DeleteKeyWithContext ¶
func (*UserKey) DisableKey ¶ added in v0.5.0
func (uk *UserKey) DisableKey(userId int64, accessKey string) (EmptyRecord, error)
func (*UserKey) DisableKeyWithContext ¶ added in v0.5.0
func (*UserKey) EnableKey ¶ added in v0.5.0
func (uk *UserKey) EnableKey(userId int64, accessKey string) (EmptyRecord, error)
func (*UserKey) EnableKeyWithContext ¶ added in v0.5.0
type UsersCopyParams ¶ added in v0.35.0
type UsersCopyParams struct { DestinationProviderID int64 `json:"destination_provider_id"` TenantID int64 `json:"tenant_id,omitempty"` UserIDs []int64 `json:"user_ids,omitempty"` }
UsersCopyParams represents the parameters for copying users
type VMSConfig ¶
type VMSConfig struct { Host string // The hostname or IP address of the VMS API server. Port uint64 // The port to connect to on the VMS API server. Username string // The username for authentication (used with Password). Password string // The password for authentication (used with Username). ApiToken string // Optional API token for authentication (alternative to Username/Password). Tenant string // Optional tenant name for tenant scoped authentication (tenant admin). SslVerify bool // Whether to verify SSL certificates. Timeout *time.Duration // HTTP client timeout. If nil, a default is applied by validators. MaxConnections int // Maximum number of concurrent HTTP connections. UserAgent string // Optional custom User-Agent header to use in HTTP requests. If empty, a default may be applied. ApiVersion string // Optional API version // BeforeRequestFn is an optional function hook executed before an API request is sent. // It allows for request inspection, mutation, or logging. // // Parameters: // - ctx: The request context for managing deadlines and cancellations. // - req: Request object // - verb: The HTTP method (e.g., GET, POST, PUT). // - url: The target URL (path and query parameters). // - body: The request body reader, typically containing JSON payload. // // Return: // - error: Any error returned will abort the request. BeforeRequestFn func(ctx context.Context, r *http.Request, verb, url string, body io.Reader) error // AfterRequestFn is an optional function hook executed after receiving an API response. // It can be used for post-processing, transformation, or logging of the response. // // Parameters: // - ctx: The request context for managing deadlines and cancellations. // - response: A Renderable result such as Record, RecordSet, or EmptyRecord. // // Returns: // - A potentially modified Renderable object. // - An error, if processing the response fails. AfterRequestFn func(ctx context.Context, response Renderable) (Renderable, error) // FillFn optionally overrides the default function used to populate structs // from generic Record maps. If provided, this function is invoked instead of // the default JSON-based marshal/unmarshal logic. // // This is useful for customizing how API responses are decoded into typed // structures — for example, using a different decoding library or adding hooks. // // Parameters: // - r: The Record to fill from (typically parsed from JSON response). // - container: A pointer to a struct to be populated. // // Returns: // - error: Any decoding or validation error encountered during population. FillFn func(r Record, container any) error }
VMSConfig represents the configuration required to create a VMS session.
func (*VMSConfig) Validate ¶
func (config *VMSConfig) Validate(validators ...VMSConfigFunc)
Validate applies the given VMSConfigFunc validators to the config. Panics if any validator returns an error.
type VMSConfigFunc ¶
VMSConfigFunc defines a function that can modify or validate a VMSConfig.
type VMSRest ¶
type VMSRest struct { Session RESTSession OpenAPI *OpenAPI Versions *Version VTasks *VTask Quotas *Quota Views *View VipPools *VipPool Users *User UserKeys *UserKey Snapshots *Snapshot BlockHosts *BlockHost Volumes *Volume BlockHostMappings *BlockHostMapping Cnodes *Cnode QosPolicies *QosPolicy Dns *Dns ViewPolies *ViewPolicy Groups *Group Nis *Nis Tenants *Tenant Ldaps *Ldap S3LifeCycleRules *S3LifeCycleRule ActiveDirectories *ActiveDirectory S3Policies *S3Policy ProtectedPaths *ProtectedPath GlobalSnapshotStreams *GlobalSnapshotStream ReplicationPeers *ReplicationPeers ProtectionPolicies *ProtectionPolicy S3replicationPeers *S3replicationPeers Realms *Realm Roles *Role NonLocalUsers *NonLocalUser NonLocalGroups *NonLocalGroup NonLocalUserKeys *NonLocalUserKey ApiTokens *ApiToken KafkaBrokers *KafkaBroker Managers *Manager Folders *Folder EventDefinitions *EventDefinition EventDefinitionConfigs *EventDefinitionConfig BGPConfigs *BGPConfig Vms *Vms Topics *Topic LocalProviders *LocalProvider LocalS3Keys *LocalS3Key EncryptionGroups *EncryptionGroup SamlConfigs *SamlConfig // contains filtered or unexported fields }
func NewVMSRest ¶
type VMSSession ¶
type VMSSession struct {
// contains filtered or unexported fields
}
func NewVMSSession ¶
func NewVMSSession(config *VMSConfig) (*VMSSession, error)
func (*VMSSession) Delete ¶
func (s *VMSSession) Delete(ctx context.Context, url string, body Params) (Renderable, error)
func (*VMSSession) Get ¶
func (s *VMSSession) Get(ctx context.Context, url string, _ Params) (Renderable, error)
func (*VMSSession) GetAuthenticator ¶
func (s *VMSSession) GetAuthenticator() Authenticator
func (*VMSSession) GetConfig ¶
func (s *VMSSession) GetConfig() *VMSConfig
func (*VMSSession) Patch ¶
func (s *VMSSession) Patch(ctx context.Context, url string, body Params) (Renderable, error)
func (*VMSSession) Post ¶
func (s *VMSSession) Post(ctx context.Context, url string, body Params) (Renderable, error)
func (*VMSSession) Put ¶
func (s *VMSSession) Put(ctx context.Context, url string, body Params) (Renderable, error)
type VMSSessionMethod ¶
type VTask ¶
type VTask struct {
*VastResource
}
func (*VTask) WaitTaskWithContext ¶
WaitTaskWithContext polls the task status until it completes, fails, or the context expires.
It starts with a 500ms polling interval and increases it slightly after each attempt, using exponential-style backoff (capped at 5 seconds). This reduces the load on the API during long-running tasks.
Task states:
- "completed" → returns the task Record.
- "running" → continues polling.
- any other state → considered failure, and returns the last message from the task.
If the context deadline is exceeded or canceled, the method returns an error with context cause.
Parameters:
- ctx: context with optional timeout or cancellation.
- taskId: unique identifier of the task to wait for.
Returns:
- Record: the completed task record, if successful.
- error: if the task failed, context expired, or an API error occurred.
type VastResource ¶
type VastResource struct {
// contains filtered or unexported fields
}
VastResource implements VastResourceAPI and provides common behavior for managing VAST resources.
func (*VastResource) Create ¶
func (e *VastResource) Create(params Params) (Record, error)
Create creates a new resource using the provided parameters and the bound REST context.
func (*VastResource) CreateWithContext ¶ added in v0.3.0
CreateWithContext creates a new resource using the provided parameters and context.
func (*VastResource) Delete ¶
func (e *VastResource) Delete(searchParams, deleteParams Params) (EmptyRecord, error)
Delete deletes a resource found with searchParams using deleteParams and the bound REST context. Returns success even if the resource is not found.
func (*VastResource) DeleteById ¶
func (e *VastResource) DeleteById(id any, queryParams, deleteParams Params) (EmptyRecord, error)
DeleteById deletes a resource by its ID using the bound REST context and provided deleteParams.
func (*VastResource) DeleteByIdWithContext ¶ added in v0.3.0
func (e *VastResource) DeleteByIdWithContext(ctx context.Context, id any, queryParams, deleteParams Params) (EmptyRecord, error)
DeleteByIdWithContext deletes a resource by its unique ID using the provided context and delete parameters.
func (*VastResource) DeleteNonId ¶ added in v0.11.0
func (e *VastResource) DeleteNonId(queryParams, deleteParams Params) (EmptyRecord, error)
DeleteNonId deletes a resource that does not use a numeric ID for identification. The resource is identified using unique fields within the provided parameters (e.g., SID, UID). This method delegates to DeleteNonIdWithContext using the default context.
func (*VastResource) DeleteNonIdWithContext ¶ added in v0.11.0
func (e *VastResource) DeleteNonIdWithContext(ctx context.Context, queryParams, deleteParams Params) (EmptyRecord, error)
DeleteNonIdWithContext deletes a resource that does not use a numeric ID for identification. The resource is identified using unique fields within the provided parameters (e.g., SID, UID).
func (*VastResource) DeleteWithContext ¶ added in v0.3.0
func (e *VastResource) DeleteWithContext(ctx context.Context, searchParams, queryParams, deleteParams Params) (EmptyRecord, error)
DeleteWithContext deletes a resource found using searchParams, using the provided deleteParams, within the given context. If the resource is not found, it returns success without error.
func (*VastResource) Ensure ¶
func (e *VastResource) Ensure(searchParams, body Params) (Record, error)
Ensure ensures a resource exists matching the searchParams. Creates it with body if not found. Uses the bound REST context.
func (*VastResource) EnsureByName ¶
func (e *VastResource) EnsureByName(name string, body Params) (Record, error)
EnsureByName ensures a resource with the given name exists using the bound REST context. Creates it with the provided body if not found.
func (*VastResource) EnsureByNameWithContext ¶ added in v0.3.0
func (e *VastResource) EnsureByNameWithContext(ctx context.Context, name string, body Params) (Record, error)
EnsureByNameWithContext ensures a resource with the given name exists. If not, it creates one using the provided body. All operations are performed within the provided context.
func (*VastResource) EnsureWithContext ¶ added in v0.3.0
func (e *VastResource) EnsureWithContext(ctx context.Context, searchParams Params, body Params) (Record, error)
EnsureWithContext ensures a resource matching the search parameters exists. If not, it creates it using the body. All operations are performed within the given context.
func (*VastResource) Exists ¶
func (e *VastResource) Exists(params Params) (bool, error)
Exists checks if any resource matches the given parameters using the bound REST context. Returns true if a match is found, false if not. Returns error only for unexpected issues.
func (*VastResource) ExistsWithContext ¶ added in v0.3.0
ExistsWithContext checks if any resource matches the provided parameters within the given context. Returns true if a match is found. Returns false if not found. Returns an error only if an unexpected failure occurs.
func (*VastResource) Get ¶
func (e *VastResource) Get(params Params) (Record, error)
Get retrieves a single resource matching the given parameters using the bound REST context. Returns NotFoundError if the resource does not exist.
func (*VastResource) GetById ¶
func (e *VastResource) GetById(id any) (Record, error)
GetById retrieves a resource by its ID using the bound REST context.
func (*VastResource) GetByIdWithContext ¶ added in v0.3.0
GetByIdWithContext retrieves a resource by its unique ID using the provided context.
Not all VAST resources have strictly numeric IDs; some may use UUIDs, names, or other formats. Therefore, this method accepts a generic 'id' parameter and dynamically formats the request path to handle both numeric and non-numeric identifiers.
func (*VastResource) GetResourcePath ¶ added in v0.6.0
func (e *VastResource) GetResourcePath() string
func (*VastResource) GetResourceType ¶
func (e *VastResource) GetResourceType() string
func (*VastResource) GetWithContext ¶ added in v0.3.0
GetWithContext retrieves a single resource that matches the given parameters using the provided context. Returns a NotFoundError if no resource is found.
func (*VastResource) List ¶
func (e *VastResource) List(params Params) (RecordSet, error)
List retrieves all resources matching the given parameters using the bound REST context.
func (*VastResource) ListWithContext ¶ added in v0.3.0
ListWithContext retrieves all resources matching the given parameters using the provided context.
func (*VastResource) Lock ¶ added in v0.3.0
func (e *VastResource) Lock(keys ...any) func()
Lock acquires the resource-level mutex and returns a function to release it. This allows for convenient deferring of unlock operations:
defer resource.Lock()()
func (*VastResource) MustExists ¶ added in v0.3.0
func (e *VastResource) MustExists(params Params) bool
MustExists performs an existence check for a resource using the given parameters. It returns true if the resource exists, or false if it does not. If an error occurs during the check (other than not-found), the method panics. This is a convenience method intended for use in control paths where failures are not expected or tolerated.
func (*VastResource) MustExistsWithContext ¶ added in v0.3.0
func (e *VastResource) MustExistsWithContext(ctx context.Context, params Params) bool
MustExistsWithContext checks if a resource exists using the provided context and parameters. It returns true if the resource exists, and false otherwise. This method panics if an unexpected error occurs during the check. It is intended for use in scenarios where failure to access the resource is considered fatal.
func (*VastResource) Session ¶
func (e *VastResource) Session() RESTSession
Session returns the current VMSSession associated with the resource.
func (*VastResource) Update ¶
func (e *VastResource) Update(id any, params Params) (Record, error)
Update updates a resource by its ID using the provided parameters and the bound REST context.
func (*VastResource) UpdateNonId ¶ added in v0.11.0
func (e *VastResource) UpdateNonId(params Params) (Record, error)
UpdateNonId updates a resource that does not use a numeric ID for identification. The resource is identified using unique fields within the provided parameters (e.g., SID, UID). This method delegates to UpdateNonIdWithContext using the default context.
func (*VastResource) UpdateNonIdWithContext ¶ added in v0.11.0
UpdateNonIdWithContext updates a resource that does not use a numeric ID for identification. The resource is identified using unique fields within the provided parameters (e.g., SID, UID).
func (*VastResource) UpdateWithContext ¶ added in v0.3.0
UpdateWithContext updates an existing resource by its ID using the provided parameters and context.
type VastResourceAPI ¶ added in v0.3.0
type VastResourceAPI interface { Session() RESTSession GetResourceType() string GetResourcePath() string // normalized path to the resource in OpenAPI format List(Params) (RecordSet, error) Create(Params) (Record, error) Update(any, Params) (Record, error) UpdateNonId(Params) (Record, error) Delete(Params, Params) (EmptyRecord, error) DeleteById(any, Params, Params) (EmptyRecord, error) DeleteNonId(Params, Params) (EmptyRecord, error) Ensure(Params, Params) (Record, error) EnsureByName(string, Params) (Record, error) Get(Params) (Record, error) GetById(any) (Record, error) Exists(Params) (bool, error) MustExists(Params) bool // Resource-level mutex lock for concurrent access control Lock(...any) func() // contains filtered or unexported methods }
VastResourceAPI defines the interface for standard CRUD operations on a VAST resource.
type VastResourceAPIWithContext ¶ added in v0.3.0
type VastResourceAPIWithContext interface { VastResourceAPI ListWithContext(context.Context, Params) (RecordSet, error) CreateWithContext(context.Context, Params) (Record, error) UpdateWithContext(context.Context, any, Params) (Record, error) UpdateNonIdWithContext(context.Context, Params) (Record, error) DeleteWithContext(context.Context, Params, Params, Params) (EmptyRecord, error) DeleteByIdWithContext(context.Context, any, Params, Params) (EmptyRecord, error) DeleteNonIdWithContext(context.Context, Params, Params) (EmptyRecord, error) EnsureWithContext(context.Context, Params, Params) (Record, error) EnsureByNameWithContext(context.Context, string, Params) (Record, error) GetWithContext(context.Context, Params) (Record, error) GetByIdWithContext(context.Context, any) (Record, error) ExistsWithContext(context.Context, Params) (bool, error) MustExistsWithContext(context.Context, Params) bool }
type VastResourceType ¶
type VastResourceType interface { Dummy | Version | Quota | View | VipPool | User | UserKey | Snapshot | BlockHost | Volume | VTask | BlockHostMapping | Cnode | QosPolicy | Dns | ViewPolicy | Group | Nis | Tenant | Ldap | S3LifeCycleRule | ActiveDirectory | S3Policy | ProtectedPath | GlobalSnapshotStream | ReplicationPeers | ProtectionPolicy | S3replicationPeers | Realm | Role | NonLocalUser | NonLocalGroup | NonLocalUserKey | ApiToken | KafkaBroker | Manager | Folder | EventDefinition | EventDefinitionConfig | BGPConfig | Vms | Topic | LocalProvider | LocalS3Key | EncryptionGroup | SamlConfig }
type Version ¶
type Version struct {
*VastResource
}
func (*Version) CompareWith ¶
func (*Version) CompareWithWithContext ¶
func (*Version) GetVersion ¶
type View ¶
type View struct {
*VastResource
}
type ViewPolicy ¶
type ViewPolicy struct {
*VastResource
}
type VipPool ¶
type VipPool struct {
*VastResource
}
type Vms ¶ added in v0.29.0
type Vms struct {
*VastResource
}
func (*Vms) GetConfiguredIdPs ¶ added in v0.40.0
func (*Vms) GetConfiguredIdPsWithContext ¶ added in v0.40.0
func (*Vms) SetMaxApiTokensPerUser ¶ added in v0.29.0
func (v *Vms) SetMaxApiTokensPerUser(vmsId int64, tokensCount int64) (EmptyRecord, error)
func (*Vms) SetMaxApiTokensPerUserWithContext ¶ added in v0.29.0
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
apitoken
command
|
|
blockhostmapping
command
|
|
blockhosts
command
|
|
encryption_groups
command
|
|
eventdefinitions
command
|
|
folders
command
|
|
globalsnapshotstream
command
|
|
kafkabroker
command
|
|
metrics
command
|
|
nonlocalgroup
command
|
|
nonlocaluser
command
|
|
nonlocaluserkey
command
|
|
openapi-schema
command
|
|
quota
command
|
|
raw-request
command
|
|
request-interceptors
command
|
|
samlconfig
command
|
|
topics
command
|
|
user
command
|
|
userkeys
command
|
|
version
command
|
|
view
command
|
|
vippool
command
|
|
vms
command
|