api

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package api provides the main ARK SDK API interface for accessing all ARK services in the ARK SDK Golang. This package serves as the central entry point for interacting with various ARK services including SIA, SecHub, PCloud, Identity, and other components.

The ArkAPI struct acts as a service factory and registry, managing authenticators, service instances, and configuration profiles. It provides lazy loading of services, meaning services are only instantiated when first accessed, and subsequent calls return the cached instance.

Key features:

  • Centralized access to all ARK services
  • Lazy loading and caching of service instances
  • Authenticator management and distribution to services
  • Profile-based configuration management
  • Service dependency injection with authenticators
  • Consistent error handling across all services

The API supports multiple authenticators that are automatically distributed to services based on their configuration requirements. Each service specifies required and optional authenticators, and the API ensures the appropriate authenticators are provided during service initialization.

Example:

// Create authenticators
ispAuth := &auth.ArkISPAuth{...}
authenticators := []auth.ArkAuth{ispAuth}

// Create API instance
api, err := NewArkAPI(authenticators, nil) // nil uses default profile
if err != nil {
	// handle error
}

// Access services (lazy loaded)
ssoService, err := api.SiaSso()
if err != nil {
	// handle error
}

// Get specific authenticator
auth, err := api.Authenticator("isp")
if err != nil {
	// handle error
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArkAPI

type ArkAPI struct {
	// contains filtered or unexported fields
}

ArkAPI wraps different API functionality of Ark Services.

ArkAPI serves as the central entry point and service factory for all ARK services. It manages authenticators, service instances, and configuration profiles, providing a unified interface for accessing various ARK components including SIA, SecHub, PCloud, Identity, and other services.

The struct implements lazy loading for services - each service is only instantiated when first accessed through its corresponding method. Subsequent calls return the cached instance, ensuring efficient resource usage and consistent service state.

Service creation follows a dependency injection pattern where authenticators are automatically distributed to services based on their configuration requirements. Each service specifies required and optional authenticators, and ArkAPI ensures the appropriate authenticators are provided during initialization.

func NewArkAPI

func NewArkAPI(authenticators []auth.ArkAuth, profile *models.ArkProfile) (*ArkAPI, error)

NewArkAPI creates a new ArkAPI instance with the provided authenticators and profile.

Initializes a new ArkAPI instance that serves as the central access point for all ARK services. The instance manages the provided authenticators and distributes them to services as needed. If no profile is provided (nil), the default profile is loaded automatically.

The services map is initialized empty and services are created lazily when first accessed through their respective getter methods. This approach ensures optimal resource usage and faster startup times.

Parameters:

  • authenticators: Slice of authenticators to be used by services. Each service will receive the authenticators it requires based on its configuration
  • profile: Configuration profile to use. If nil, the default profile is loaded automatically using the default profile loader

Returns a pointer to the initialized ArkAPI instance, or an error if the default profile cannot be loaded when profile is nil.

Example:

// With explicit profile
profile := &models.ArkProfile{...}
api, err := NewArkAPI(authenticators, profile)

// With default profile (recommended)
api, err := NewArkAPI(authenticators, nil)
if err != nil {
	// handle profile loading error
}

func (*ArkAPI) Authenticator

func (api *ArkAPI) Authenticator(authenticatorName string) (auth.ArkAuth, error)

Authenticator returns the authenticator with the specified name from the ArkAPI instance.

Searches through the API's authenticator collection and returns the first authenticator that matches the specified name. This method provides access to specific authenticators for custom operations or debugging purposes.

The search is case-sensitive and matches the exact authenticator name as returned by the authenticator's AuthenticatorName() method.

Parameters:

  • authenticatorName: The exact name of the authenticator to retrieve

Returns the matching authenticator, or an error if no authenticator with the specified name is found.

Example:

ispAuth, err := api.Authenticator("isp")
if err != nil {
	// handle authenticator not found
}
// use ispAuth for custom operations

func (*ArkAPI) Cmgr

func (api *ArkAPI) Cmgr() (*cmgr.ArkCmgrService, error)

Cmgr returns the Cmgr service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) IdentityDirectories

func (api *ArkAPI) IdentityDirectories() (*directories.ArkIdentityDirectoriesService, error)

IdentityDirectories returns the IdentityDirectories service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) IdentityRoles

func (api *ArkAPI) IdentityRoles() (*roles.ArkIdentityRolesService, error)

IdentityRoles returns the IdentityRoles service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) IdentityUsers

func (api *ArkAPI) IdentityUsers() (*users.ArkIdentityUsersService, error)

IdentityUsers returns the IdentityUsers service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) PCloudAccounts

func (api *ArkAPI) PCloudAccounts() (*accounts.ArkPCloudAccountsService, error)

PCloudAccounts returns the PCloudAccounts service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) PCloudSafes

func (api *ArkAPI) PCloudSafes() (*safes.ArkPCloudSafesService, error)

PCloudSafes returns the PCloudSafes service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) Profile

func (api *ArkAPI) Profile() *models.ArkProfile

Profile returns the profile associated with the ArkAPI instance.

Provides access to the configuration profile that was set during API initialization. The profile contains environment-specific settings, endpoints, and other configuration parameters used by the various ARK services.

The returned profile is the same instance that was either explicitly provided to NewArkAPI or automatically loaded as the default profile when nil was passed.

Returns a pointer to the ArkProfile instance. The profile is never nil for a properly initialized ArkAPI instance.

Example:

profile := api.Profile()
fmt.Printf("Using profile: %s\n", profile.ProfileName)

func (*ArkAPI) SecHubConfiguration added in v1.1.0

func (api *ArkAPI) SecHubConfiguration() (*configuration.ArkSecHubConfigurationService, error)

SecHubConfiguration returns the SecHub Configuration service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubFilters added in v1.1.0

func (api *ArkAPI) SecHubFilters() (*filters.ArkSecHubFiltersService, error)

SecHubFilters returns the SecHub Filters service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubScans added in v1.1.0

func (api *ArkAPI) SecHubScans() (*scans.ArkSecHubScansService, error)

SecHubScans returns the SecHub Scans service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubSecretStores added in v1.1.0

func (api *ArkAPI) SecHubSecretStores() (*secretstores.ArkSecHubSecretStoresService, error)

SecHubSecretStores returns the SecHub Secret Stores service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubSecrets added in v1.1.0

func (api *ArkAPI) SecHubSecrets() (*secrets.ArkSecHubSecretsService, error)

SecHubSecrets returns the SecHub Secrets service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubServiceInfo added in v1.1.0

func (api *ArkAPI) SecHubServiceInfo() (*serviceinfo.ArkSecHubServiceInfoService, error)

SecHubServiceInfo returns the SecHub Service Info service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SecHubSyncPolicies added in v1.1.0

func (api *ArkAPI) SecHubSyncPolicies() (*syncpolicies.ArkSecHubSyncPoliciesService, error)

SecHubSyncPolicies returns the SecHub Sync Policies service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaAccess

func (api *ArkAPI) SiaAccess() (*siaaccess.ArkSIAAccessService, error)

SiaAccess returns the SiaAccess service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaDb added in v1.3.0

func (api *ArkAPI) SiaDb() (*siadb.ArkSIADBService, error)

SiaDb returns the SiaDb service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaK8s

func (api *ArkAPI) SiaK8s() (*siak8s.ArkSIAK8SService, error)

SiaK8s returns the SiaK8s service from the ArkAPI instance. If the service is not already created, it creates a new one.

Provides access to the SIA Kubernetes service for managing Kubernetes cluster access and operations. The service is created using lazy loading - if this is the first call, a new service instance is created and cached. Subsequent calls return the cached instance.

The service is initialized with authenticators that match its configuration requirements. If the service cannot be created due to missing authenticators or initialization errors, an error is returned.

Returns a pointer to the ArkSIAK8SService instance, or an error if the service cannot be created or initialized.

Example:

k8sService, err := api.SiaK8s()
if err != nil {
	// handle service creation error
}
// use k8sService for Kubernetes operations

func (*ArkAPI) SiaSSHCa added in v1.2.0

func (api *ArkAPI) SiaSSHCa() (*siasshca.ArkSIASSHCAService, error)

SiaSSHCa returns the SiaSSHCa service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaSecretsDB

func (api *ArkAPI) SiaSecretsDB() (*siasecretsdb.ArkSIASecretsDBService, error)

SiaSecretsDB returns the SiaSecretsDB service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaSecretsVM

func (api *ArkAPI) SiaSecretsVM() (*siasecretsvm.ArkSIASecretsVMService, error)

SiaSecretsVM returns the SiaSecretsVM service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaSso

func (api *ArkAPI) SiaSso() (*siasso.ArkSIASSOService, error)

SiaSso returns the SiaSSO service from the ArkAPI instance. If the service is not already created, it creates a new one.

Provides access to the SIA Single Sign-On service for authentication and user session management operations. The service is created using lazy loading - if this is the first call, a new service instance is created and cached. Subsequent calls return the cached instance.

The service is initialized with authenticators that match its configuration requirements. If the service cannot be created due to missing authenticators or initialization errors, an error is returned.

Returns a pointer to the ArkSIASSOService instance, or an error if the service cannot be created or initialized.

Example:

ssoService, err := api.SiaSso()
if err != nil {
	// handle service creation error
}
// use ssoService for SSO operations

func (*ArkAPI) SiaWorkspacesDB

func (api *ArkAPI) SiaWorkspacesDB() (*siaworkspacesdb.ArkSIAWorkspacesDBService, error)

SiaWorkspacesDB returns the Workspaces DB service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) SiaWorkspacesTargetSets

func (api *ArkAPI) SiaWorkspacesTargetSets() (*siatargetsets.ArkSIAWorkspacesTargetSetsService, error)

SiaWorkspacesTargetSets returns the SiaWorkspacesTargetSets service from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) Sm added in v1.2.0

func (api *ArkAPI) Sm() (*sm.ArkSMService, error)

Sm returns the SMService from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) Uap added in v1.3.0

func (api *ArkAPI) Uap() (*uap.ArkUAPService, error)

Uap returns the UapService from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) UapDb added in v1.3.0

func (api *ArkAPI) UapDb() (*db.ArkUAPSIADBService, error)

UapDb returns the UapSiaDbService from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) UapSca added in v1.3.0

func (api *ArkAPI) UapSca() (*sca.ArkUAPSCAService, error)

UapSca returns the UapScaService from the ArkAPI instance. If the service is not already created, it creates a new one.

func (*ArkAPI) UapVM added in v1.3.0

func (api *ArkAPI) UapVM() (*vm.ArkUAPSIAVMService, error)

UapVM returns the UapSiaVmService from the ArkAPI instance. If the service is not already created, it creates a new one.

Directories

Path Synopsis
Package actions provides base functionality for Ark SDK command line actions.
Package actions provides base functionality for Ark SDK command line actions.
Package common provides shared utilities and types for the ARK SDK.
Package common provides shared utilities and types for the ARK SDK.
args
Package args provides command-line argument handling utilities for the ARK SDK.
Package args provides command-line argument handling utilities for the ARK SDK.
connections/ssh
Package ssh provides Secure Shell (SSH) connection capabilities for the ARK SDK Golang.
Package ssh provides Secure Shell (SSH) connection capabilities for the ARK SDK Golang.
connections/winrm
Package winrm provides Windows Remote Management (WinRM) connection capabilities for the ARK SDK Golang.
Package winrm provides Windows Remote Management (WinRM) connection capabilities for the ARK SDK Golang.
isp
Package isp provides ISP (Identity Service Provider) client functionality for the ARK SDK.
Package isp provides ISP (Identity Service Provider) client functionality for the ARK SDK.
Package models provides data structures and types for the ARK SDK.
Package models provides data structures and types for the ARK SDK.
common
Package common provides common models and utilities for AWS environment management and configuration handling within the ARK SDK.
Package common provides common models and utilities for AWS environment management and configuration handling within the ARK SDK.
common/identity
Package identity provides data structures and types for ARK Identity directory services.
Package identity provides data structures and types for ARK Identity directory services.
sia
sm
uap

Jump to

Keyboard shortcuts

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