Documentation ¶
Index ¶
- type ApplicationService
- func (s *ApplicationService) DisableTrackLatestRelease(ctx context.Context, applicationID int64) ([]byte, error)
- func (s *ApplicationService) EnableTrackLatestRelease(ctx context.Context, applicationID int64) ([]byte, error)
- func (s *ApplicationService) Get(ctx context.Context, applicationID int64) (*ApplicationsResponse, error)
- func (s *ApplicationService) GetByName(ctx context.Context, applicationName string) (*ApplicationsResponse, error)
- func (s *ApplicationService) GetWithQuery(ctx context.Context, query string) ([]*ApplicationsResponse, error)
- func (s *ApplicationService) List(ctx context.Context) ([]*ApplicationsResponse, error)
- type ApplicationState
- type ApplicationsResponse
- type Client
- func (c *Client) Do(req *http.Request, v interface{}) error
- func (c *Client) NewRequest(ctx context.Context, method string, urlStr string, rawQuery string, ...) (*http.Request, error)
- func (c *Client) SupervisorV1(applicationID int64, deviceUUID string) *SupervisorV1Service
- func (c *Client) SupervisorV2(applicationID int64, deviceUUID string) *SupervisorV2Service
- type CloudRequest
- type DeviceConfVarResponse
- type DeviceConfVarService
- func (s *DeviceConfVarService) Create(ctx context.Context, deviceID IDOrUUID, name string, value string) (*DeviceConfVarResponse, error)
- func (s *DeviceConfVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
- func (s *DeviceConfVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceConfVarResponse, error)
- type DeviceEnvVarResponse
- type DeviceEnvVarService
- func (s *DeviceEnvVarService) Create(ctx context.Context, deviceID IDOrUUID, name string, value string) (*DeviceEnvVarResponse, error)
- func (s *DeviceEnvVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
- func (s *DeviceEnvVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceEnvVarResponse, error)
- func (s *DeviceEnvVarService) Update(ctx context.Context, deviceID IDOrUUID, name, newValue string) error
- type DeviceResponse
- type DeviceServVarCreateResponse
- type DeviceServVarResponse
- type DeviceServVarService
- func (s *DeviceServVarService) Create(ctx context.Context, serviceInstallID int64, name string, value string) (*DeviceServVarCreateResponse, error)
- func (s *DeviceServVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
- func (s *DeviceServVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceServVarResponse, error)
- func (s *DeviceServVarService) Update(ctx context.Context, deviceID IDOrUUID, name, newValue string) error
- type DeviceService
- func (s *DeviceService) Get(ctx context.Context, deviceID IDOrUUID) (*DeviceResponse, error)
- func (s *DeviceService) GetWithQuery(ctx context.Context, query string) ([]*DeviceResponse, error)
- func (s *DeviceService) List(ctx context.Context) ([]*DeviceResponse, error)
- func (s *DeviceService) ListByApplication(ctx context.Context, applicationID int64) ([]*DeviceResponse, error)
- func (s *DeviceService) MoveToApplication(ctx context.Context, deviceID IDOrUUID, applicationID int64) ([]byte, error)
- func (s *DeviceService) PinRelease(ctx context.Context, deviceID IDOrUUID, releaseID int64) ([]byte, error)
- func (s *DeviceService) TrackLatestRelease(ctx context.Context, deviceID IDOrUUID) ([]byte, error)
- type DeviceTagResponse
- type DeviceTagService
- func (s *DeviceTagService) Create(ctx context.Context, deviceID IDOrUUID, key string, value string) (*DeviceTagResponse, error)
- func (s *DeviceTagService) DeleteWithKey(ctx context.Context, deviceID IDOrUUID, key string) error
- func (s *DeviceTagService) GetWithKey(ctx context.Context, deviceID IDOrUUID, key string) (*DeviceTagResponse, error)
- func (s *DeviceTagService) GetWithQuery(ctx context.Context, query string) ([]*DeviceTagResponse, error)
- func (s *DeviceTagService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceTagResponse, error)
- func (s *DeviceTagService) UpdateWithKey(ctx context.Context, deviceID IDOrUUID, key, value string) error
- type DeviceTypeResponse
- type DeviceTypeService
- type ErrorResponse
- type IDOrUUID
- type Image
- type ImageResponse
- type InstallsService
- type ReleaseResponse
- type ReleaseService
- type ReleaseTagResponse
- type ReleaseTagService
- func (s *ReleaseTagService) GetWithQuery(ctx context.Context, query string) ([]*ReleaseTagResponse, error)
- func (s *ReleaseTagService) List(ctx context.Context, releaseID int64) ([]*ReleaseTagResponse, error)
- func (s *ReleaseTagService) ListByCommit(ctx context.Context, commit string) ([]*ReleaseTagResponse, error)
- type ServiceInstallResponse
- type ServiceInstallService
- type ServiceInstalls
- type ServiceState
- type SupervisorV1Service
- type SupervisorV2Service
- type SvAppStateResp
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationService ¶
type ApplicationService service
ApplicationService handles communication with the application related methods of the Balena Cloud API.
func (*ApplicationService) DisableTrackLatestRelease ¶
func (s *ApplicationService) DisableTrackLatestRelease(ctx context.Context, applicationID int64) ([]byte, error)
DisableTrackLatestRelease sets all devices owned by the application to NOT track the latest available release.
func (*ApplicationService) EnableTrackLatestRelease ¶
func (s *ApplicationService) EnableTrackLatestRelease(ctx context.Context, applicationID int64) ([]byte, error)
EnableTrackLatestRelease sets all devices owned by the application to track the latest available release.
func (*ApplicationService) Get ¶
func (s *ApplicationService) Get(ctx context.Context, applicationID int64) (*ApplicationsResponse, error)
Get returns information on a single application given its ID. If the application does not exist, both the response and error are nil.
func (*ApplicationService) GetByName ¶
func (s *ApplicationService) GetByName(ctx context.Context, applicationName string) (*ApplicationsResponse, error)
GetByName returns information on a single application given its Name If the application does not exist, both the response and error are nil.
func (*ApplicationService) GetWithQuery ¶
func (s *ApplicationService) GetWithQuery(ctx context.Context, query string) ([]*ApplicationsResponse, error)
GetWithQuery allows querying for devices using a custom open data protocol query. The query should be a valid, escaped OData query such as `%24filter=uuid+eq+'12333422'`.
Forward slash in filter keys should not be escaped (So `device/uuid` should not be escaped).
func (*ApplicationService) List ¶
func (s *ApplicationService) List(ctx context.Context) ([]*ApplicationsResponse, error)
type ApplicationState ¶
type ApplicationState struct {
Services map[string]ServiceState `json:"services,omitempty"`
}
type ApplicationsResponse ¶
type ApplicationsResponse struct { ID int64 `json:"id,omitempty"` ShouldTrackLatestRelease bool `json:"should_track_latest_release,omitempty"` IsPublic bool `json:"is_public,omitempty"` IsHost bool `json:"is_host,omitempty"` IsArchived bool `json:"is_archived,omitempty"` IsDiscoverable bool `json:"is_discoverable,omitempty"` UUID string `json:"uuid,omitempty"` IsStoredAtRepositoryURL string `json:"is_stored_at__repository_url,omitempty"` CreatedAt string `json:"created_at,omitempty"` AppName string `json:"app_name,omitempty"` Actor int64 `json:"actor,omitempty"` Slug string `json:"slug,omitempty"` IsOfClass string `json:"is_of__class,omitempty"` Organization *odata.Object `json:"organization,omitempty"` ShouldBeRunningRelease *odata.Object `json:"should_be_running__release,omitempty"` IsForDeviceType *odata.Object `json:"is_for__device_type,omitempty"` DependsOnApplication interface{} `json:"depends_on__application,omitempty"` IsAccessibleBySupportUntilDate interface{} `json:"is_accessible_by_support_until__date,omitempty"` }
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the public Balena Cloud API // BaseURL should always be specified with a trailing slash. BaseURL *url.URL UserAgent string // Services used for talking to different parts of the Balena API Application *ApplicationService Device *DeviceService Release *ReleaseService ReleaseTag *ReleaseTagService DeviceEnvVar *DeviceEnvVarService DeviceServVar *DeviceServVarService DeviceConfVar *DeviceConfVarService DeviceTag *DeviceTagService ServiceInstall *ServiceInstallService DeviceType *DeviceTypeService // contains filtered or unexported fields }
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
func (c *Client) NewRequest( ctx context.Context, method string, urlStr string, rawQuery string, body interface{}, ) (*http.Request, error)
NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body. A raw query string can be specified by rawQuery.
func (*Client) SupervisorV1 ¶
func (c *Client) SupervisorV1(applicationID int64, deviceUUID string) *SupervisorV1Service
SupervisorV1 returns a SupervisorV1Service to be used with balena cloud.Supervisor For local supervisor communication use balena.NewSupervisorV1() instead.
func (*Client) SupervisorV2 ¶
func (c *Client) SupervisorV2(applicationID int64, deviceUUID string) *SupervisorV2Service
SupervisorV2 returns a SupervisorV2Service to be used with balena cloud.Supervisor For local supervisor communication use balena.NewSupervisorV2() instead.
type CloudRequest ¶
type DeviceConfVarResponse ¶ added in v0.4.0
type DeviceConfVarService ¶ added in v0.4.0
type DeviceConfVarService service
func (*DeviceConfVarService) Create ¶ added in v0.4.0
func (s *DeviceConfVarService) Create( ctx context.Context, deviceID IDOrUUID, name string, value string, ) (*DeviceConfVarResponse, error)
Create creates an environment variable with name=value given a device ID/UUID.
func (*DeviceConfVarService) DeleteWithName ¶ added in v0.4.0
func (s *DeviceConfVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
DeleteWithName deletes a variable with the given name from the device with given ID/UUID. No error is returned if no variable with such name exists.
func (*DeviceConfVarService) List ¶ added in v0.4.0
func (s *DeviceConfVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceConfVarResponse, error)
List lists all environment variables given a specific device ID/UUID.
type DeviceEnvVarResponse ¶
type DeviceEnvVarService ¶
type DeviceEnvVarService service
func (*DeviceEnvVarService) Create ¶
func (s *DeviceEnvVarService) Create( ctx context.Context, deviceID IDOrUUID, name string, value string, ) (*DeviceEnvVarResponse, error)
Create creates an environment variable with name=value given a device ID/UUID.
func (*DeviceEnvVarService) DeleteWithName ¶
func (s *DeviceEnvVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
DeleteWithName deletes a variable with the given name from the device with given ID/UUID. No error is returned if no variable with such name exists.
func (*DeviceEnvVarService) List ¶
func (s *DeviceEnvVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceEnvVarResponse, error)
List lists all environment variables given a specific device ID/UUID.
func (*DeviceEnvVarService) Update ¶ added in v0.5.0
func (s *DeviceEnvVarService) Update(ctx context.Context, deviceID IDOrUUID, name, newValue string) error
Update a variable with the given name from the device with given ID/UUID to the specified new value. No error is returned if no variable with such name exists.
type DeviceResponse ¶
type DeviceResponse struct { ID int64 `json:"id,omitempty"` Actor int64 `json:"actor,omitempty"` MemoryUsage int64 `json:"memory_usage,omitempty"` MemoryTotal int64 `json:"memory_total,omitempty"` StorageUsage int64 `json:"storage_usage,omitempty"` StorageTotal int64 `json:"storage_total,omitempty"` CPUTemp int64 `json:"cpu_temp,omitempty"` CPUUsage int64 `json:"cpu_usage,omitempty"` IsOnline bool `json:"is_online,omitempty"` IsConnectedToVPN bool `json:"is_connected_to_vpn,omitempty"` IsWebAccessible bool `json:"is_web_accessible,omitempty"` IsActive bool `json:"is_active,omitempty"` IsUndervolted bool `json:"is_undervolted,omitempty"` DeviceName string `json:"device_name,omitempty"` UUID string `json:"uuid,omitempty"` // TODO: Change to time.Time maybe? LastConnectivityEvent string `json:"last_connectivity_event,omitempty"` Status string `json:"status,omitempty"` LastVPNEvent string `json:"last_vpn_event,omitempty"` // TODO: Should we change to net.IP maybe? IPAddress string `json:"ip_address,omitempty"` // TODO: Should we change to net.IP maybe? VPNAddress string `json:"vpn_address,omitempty"` // TODO: Should we change to net.IP maybe? CPUID string `json:"cpu_id,omitempty"` StorageBlockDevice string `json:"storage_block_device,omitempty"` PublicAddress string `json:"public_address,omitempty"` MACAddress string `json:"mac_address,omitempty"` APIHeartbeatState string `json:"api_heartbeat_state,omitempty"` OSVersion string `json:"os_version,omitempty"` OSVariant string `json:"os_variant,omitempty"` SupervisorVersion string `json:"supervisor_version,omitempty"` ProvisioningState string `json:"provisioning_state,omitempty"` Longitude string `json:"longitude,omitempty"` Latitude string `json:"latitude,omitempty"` Location string `json:"location,omitempty"` CustomLongitude string `json:"custom_longitude,omitempty"` CustomLatitude string `json:"custom_latitude,omitempty"` CreatedAt string `json:"created_at,omitempty"` DeviceType *odata.Object `json:"device_type,omitempty"` BelongsToApplication *odata.Object `json:"belongs_to__application,omitempty"` BelongsToUser *odata.Object `json:"belongs_to__user,omitempty"` IsManagedByServiceInstance *odata.Object `json:"is_managed_by__service_instance,omitempty"` IsManagedByDevice interface{} `json:"is_managed_by__device,omitempty"` IsRunningRelease *odata.Object `json:"is_running__release,omitempty"` ShouldBeRunningRelease *odata.Object `json:"should_be_running__release,omitempty"` ShouldBeManagedBySupervisorRelease *odata.Object `json:"should_be_managed_by__supervisor_release,omitempty"` Note interface{} `json:"note,omitempty"` LocalID interface{} `json:"local_id,omitempty"` ProvisioningProgress interface{} `json:"provisioning_progress,omitempty"` DownloadProgress interface{} `json:"download_progress,omitempty"` LogsChannel interface{} `json:"logs_channel,omitempty"` IsLockedUntil interface{} `json:"is_locked_until__date,omitempty"` IsAccessibleBySupportUntil interface{} `json:"is_accessible_by_support_until__date,omitempty"` // OverallStatus will only be populated when explicitly selected through a query parameter: `$select=overall_status`. OverallStatus string `json:"overall_status,omitempty"` }
type DeviceServVarCreateResponse ¶ added in v0.5.0
type DeviceServVarResponse ¶ added in v0.4.0
type DeviceServVarResponse struct { ID int64 `json:"id,omitempty"` CreatedAt string `json:"created_at,omitempty"` Name string `json:"name,omitempty"` Value string `json:"value,omitempty"` ServiceInstall ServiceInstalls `json:"service_install,omitempty"` }
type DeviceServVarService ¶ added in v0.4.0
type DeviceServVarService service
func (*DeviceServVarService) Create ¶ added in v0.4.0
func (s *DeviceServVarService) Create( ctx context.Context, serviceInstallID int64, name string, value string, ) (*DeviceServVarCreateResponse, error)
Create creates an environment variable with name=value given a ServiceInstall ID (see ServiceInstallService).
func (*DeviceServVarService) DeleteWithName ¶ added in v0.4.0
func (s *DeviceServVarService) DeleteWithName(ctx context.Context, deviceID IDOrUUID, name string) error
DeleteWithName deletes a variable with the given name from the device with given ID/UUID. No error is returned if no variable with such name exists.
func (*DeviceServVarService) List ¶ added in v0.4.0
func (s *DeviceServVarService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceServVarResponse, error)
List lists all environment variables given a specific device ID/UUID.
func (*DeviceServVarService) Update ¶ added in v0.5.0
func (s *DeviceServVarService) Update(ctx context.Context, deviceID IDOrUUID, name, newValue string) error
Update a variable with the given name from the device with given ID/UUID to a new value. No error is returned if no variable with such name exists.
type DeviceService ¶
type DeviceService service
DeviceService handles communication with the device related methods of the Balena Cloud API.
func (*DeviceService) Get ¶
func (s *DeviceService) Get(ctx context.Context, deviceID IDOrUUID) (*DeviceResponse, error)
Get returns information on a single device given its ID or UUID. If the device does not exist, both the response and error are nil.
Example ¶
package main import ( "context" "go.einride.tech/balena" ) func main() { token := "mytoken" // We supply a nil http client to make use of http.DefaultClient client := balena.New(nil, token) // We want a device with a given uuid deviceUUID := "00a859f211585e9417a676e09434cc55" _, _ = client.Device.Get(context.Background(), balena.DeviceUUID(deviceUUID)) }
Output:
func (*DeviceService) GetWithQuery ¶
func (s *DeviceService) GetWithQuery(ctx context.Context, query string) ([]*DeviceResponse, error)
GetWithQuery allows querying for devices using a custom open data protocol query. The query should be a valid, escaped OData query such as `%24filter=uuid+eq+'12333422'`
Forward slash in filter keys should not be escaped (So `device/uuid` should not be escaped).
Example ¶
package main import ( "context" "go.einride.tech/balena" ) func main() { token := "mytoken" // We supply a nil http client to make use of http.DefaultClient client := balena.New(nil, token) // We want a device with a given name query := "%24filter=device_name+eq+%27mydevice%27" _, _ = client.Device.GetWithQuery(context.Background(), query) }
Output:
func (*DeviceService) List ¶
func (s *DeviceService) List(ctx context.Context) ([]*DeviceResponse, error)
List returns a list of all devices.
func (*DeviceService) ListByApplication ¶
func (s *DeviceService) ListByApplication(ctx context.Context, applicationID int64) ([]*DeviceResponse, error)
ListByApplication returns a list of all devices owned by the single application given its ID.
func (*DeviceService) MoveToApplication ¶ added in v0.9.0
func (s *DeviceService) MoveToApplication(ctx context.Context, deviceID IDOrUUID, applicationID int64) ([]byte, error)
MoveToApplication changes which application a device belongs to. If the update is successful, "OK" is returned and error is nil. If either the specified device or application doesn't exist, the returned error will contain "404".
func (*DeviceService) PinRelease ¶
func (s *DeviceService) PinRelease(ctx context.Context, deviceID IDOrUUID, releaseID int64) ([]byte, error)
PinRelease pins a device to a specific release.
func (*DeviceService) TrackLatestRelease ¶
TrackLatestRelease sets a device to track the latest available release.
type DeviceTagResponse ¶
type DeviceTagService ¶
type DeviceTagService service
DeviceTagService handles communication with the device tag related methods of the Balena Cloud API.
func (*DeviceTagService) Create ¶
func (s *DeviceTagService) Create( ctx context.Context, deviceID IDOrUUID, key string, value string, ) (*DeviceTagResponse, error)
Create creates a device tag with key=value given a device ID/UUID. An error is returned if the key already exists.
func (*DeviceTagService) DeleteWithKey ¶
DeleteWithKey deletes a device tag from a given device ID/UUID and key. No error is returned if the tag does not exist.
func (*DeviceTagService) GetWithKey ¶
func (s *DeviceTagService) GetWithKey(ctx context.Context, deviceID IDOrUUID, key string) (*DeviceTagResponse, error)
GetWithKey retrieves a tag with the given key from the given device ID/UUID. If no key is found both the response and error returned are nil.
func (*DeviceTagService) GetWithQuery ¶
func (s *DeviceTagService) GetWithQuery(ctx context.Context, query string) ([]*DeviceTagResponse, error)
GetWithQuery allows querying for device tags using a custom Open Data Protocol query. The query should be a valid, escaped OData query such as `%24filter=uuid+eq+%2712333422%27`.
Forward slash in filter keys should not be escaped (So `device/uuid` should not be escaped).
func (*DeviceTagService) List ¶
func (s *DeviceTagService) List(ctx context.Context, deviceID IDOrUUID) ([]*DeviceTagResponse, error)
List lists all device tags for a given device ID/UUID.
func (*DeviceTagService) UpdateWithKey ¶
func (s *DeviceTagService) UpdateWithKey(ctx context.Context, deviceID IDOrUUID, key, value string) error
UpdateWithKey updates the value of a device tag matching the given key and device ID/UUID. No error is returned if the key or device does not exist.
type DeviceTypeResponse ¶ added in v0.8.0
type DeviceTypeResponse struct { ID uint64 `json:"id"` Name string `json:"name"` Slug string `json:"slug"` IsPrivate bool `json:"is_private"` // Logo will only be populated when explicitly selected through a query parameter: `$select=logo`. Logo string `json:"logo"` IsOfCPUArchitecture odata.Object `json:"is_of__cpu_architecture"` }
type DeviceTypeService ¶ added in v0.8.0
type DeviceTypeService service
DeviceTypeService handles communication with the device type related methods of the Balena Cloud API.
func (*DeviceTypeService) Get ¶ added in v0.8.0
func (s *DeviceTypeService) Get(ctx context.Context, id int64) (*DeviceTypeResponse, error)
Get returns information on a single device type given its ID. If the device type does not exist, both the response and error are nil.
func (*DeviceTypeService) GetWithQuery ¶ added in v0.8.0
func (s *DeviceTypeService) GetWithQuery(ctx context.Context, query string) ([]*DeviceTypeResponse, error)
GetWithQuery allows querying for device types using a custom open data protocol query. The query should be a valid, escaped OData query such as `%24filter=slug+eq+'jetson-tx2'`
Forward slash in filter keys should not be escaped (So `device_type/slug` should not be escaped).
type ErrorResponse ¶
An ErrorResponse reports the error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type IDOrUUID ¶
type IDOrUUID struct {
// contains filtered or unexported fields
}
IDOrUUID represents an ID which can be an Entity ID or an UUID.
func DeviceUUID ¶
type Image ¶ added in v0.7.0
type Image struct { CreatedAt string `json:"created_at,omitempty"` ModifiedAt string `json:"modified_at,omitempty"` ID int64 `json:"id,omitempty"` StartTimestamp string `json:"start_timestamp,omitempty"` EndTimestamp string `json:"end_timestamp,omitempty"` Dockerfile string `json:"dockerfile,omitempty"` IsABuildOfService odata.Object `json:"is_a_build_of__service,omitempty"` ImageSize int64 `json:"image_size,omitempty"` IsStoredAtImageLocation string `json:"is_stored_at__image_location,omitempty"` ProjectType string `json:"project_type,omitempty"` ErrorMessage string `json:"error_message,omitempty"` BuildLog string `json:"build_log,omitempty"` PushTimestamp string `json:"push_timestamp,omitempty"` Status string `json:"status,omitempty"` ContentHash string `json:"content_hash,omitempty"` Contract string `json:"contract,omitempty"` }
type ImageResponse ¶ added in v0.7.0
type InstallsService ¶ added in v0.5.0
type ReleaseResponse ¶
type ReleaseResponse struct { ID int64 `json:"id,omitempty"` IsInvalidated bool `json:"is_invalidated,omitempty"` IsPassingTests bool `json:"is_passing_tests,omitempty"` ReleaseType string `json:"release_type,omitempty"` Contract string `json:"contract,omitempty"` CreatedAt string `json:"created_at,omitempty"` Commit string `json:"commit,omitempty"` Status string `json:"status,omitempty"` Source string `json:"source,omitempty"` StartTimestamp string `json:"start_timestamp,omitempty"` EndTimestamp string `json:"end_timestamp,omitempty"` UpdateTimestamp string `json:"update_timestamp,omitempty"` BuildLog string `json:"build_log,omitempty"` BelongsToApplication *odata.Object `json:"belongs_to__application,omitempty"` CreatedByUser *odata.Object `json:"is_created_by__user,omitempty"` ReleaseVersion interface{} `json:"release_version,omitempty"` Composition json.RawMessage `json:"composition,omitempty"` // ReleaseImage will only be populated when explicitly selected through a query parameter: `$select=release_image`. ReleaseImage []*ImageResponse `json:"release_image,omitempty"` }
type ReleaseService ¶
type ReleaseService service
ReleaseService handles communication with the release related methods of the Balena Cloud API.
func (*ReleaseService) Get ¶
func (s *ReleaseService) Get(ctx context.Context, id int64) (*ReleaseResponse, error)
Get returns a release given a release ID. If no such release exists, both the response and error returned are nil.
func (*ReleaseService) GetWithQuery ¶
func (s *ReleaseService) GetWithQuery(ctx context.Context, query string) ([]*ReleaseResponse, error)
GetWithQuery allows querying releases using a custom open data protocol query. The query should be a valid, escaped OData query such as `%24filter=uuid+eq+'12333422'`.
Forward slash in filter keys should not be escaped (So `device/uuid` should not be escaped).
func (*ReleaseService) List ¶
func (s *ReleaseService) List(ctx context.Context) ([]*ReleaseResponse, error)
List lists all releases.
type ReleaseTagResponse ¶
type ReleaseTagService ¶
type ReleaseTagService service
ReleaseTag handles communication with the release tag related methods of the Balena Cloud API.
func (*ReleaseTagService) GetWithQuery ¶
func (s *ReleaseTagService) GetWithQuery(ctx context.Context, query string) ([]*ReleaseTagResponse, error)
GetWithQuery allows querying for release tags using a custom Open Data Protocol query. The query should be a valid, escaped OData query such as `%24filter=uuid+eq+%2712333422%27`.
Forward slash in filter keys should not be escaped (So `device/uuid` should not be escaped).
func (*ReleaseTagService) List ¶
func (s *ReleaseTagService) List(ctx context.Context, releaseID int64) ([]*ReleaseTagResponse, error)
List lists all release tags for a given release ID.
func (*ReleaseTagService) ListByCommit ¶
func (s *ReleaseTagService) ListByCommit(ctx context.Context, commit string) ([]*ReleaseTagResponse, error)
ListByCommit lists all release tags for a given release commit.
type ServiceInstallResponse ¶ added in v0.5.0
type ServiceInstallService ¶ added in v0.5.0
type ServiceInstallService service
func (*ServiceInstallService) List ¶ added in v0.5.0
func (s *ServiceInstallService) List(ctx context.Context, deviceID IDOrUUID) (ServiceInstalls, error)
List all service installs for a particular device.
type ServiceInstalls ¶ added in v0.5.0
type ServiceInstalls []*ServiceInstallResponse
func (ServiceInstalls) FindByServiceName ¶ added in v0.5.0
func (i ServiceInstalls) FindByServiceName(serviceName string) (InstallsService, bool)
FindByServiceName returns the InstallService that contains the given ServiceName. Returns true if found, else false.
func (ServiceInstalls) ServiceNames ¶ added in v0.5.0
func (i ServiceInstalls) ServiceNames() []string
ServiceNames returns a slice of all service names contained in the ServiceInstallResponse(s).
type ServiceState ¶
type SupervisorV1Service ¶
type SupervisorV1Service struct {
// contains filtered or unexported fields
}
SupervisorV1Service handles communication with the supervisor v1 related methods of the Balena API.
func NewSupervisorV1 ¶
func NewSupervisorV1(httpClient *http.Client) (*SupervisorV1Service, error)
NewSupervisorV1 returns a new supervisor v1 API client. This is only meant to be used within balena where the application can talk to the supervisor directly. For talking to the supervisor through balene cloud use the balena API client through the client.SupervisorV1() method.
type SupervisorV2Service ¶
type SupervisorV2Service struct {
// contains filtered or unexported fields
}
SupervisorService handles communication with the supervisor related methods of the Balena API.
func NewSupervisorV2 ¶
func NewSupervisorV2(httpClient *http.Client) (*SupervisorV2Service, error)
NewSupervisorV2 returns a new supervisor v2 API client. This is only meant to be used within balena where the application can talk to the supervisor directly. For talking to the supervisor through balene cloud use the balena API client through the client.SupervisorV2() method.
func (*SupervisorV2Service) ApplicationState ¶
func (s *SupervisorV2Service) ApplicationState(ctx context.Context) (*SvAppStateResp, error)
func (*SupervisorV2Service) RestartServiceByName ¶
func (s *SupervisorV2Service) RestartServiceByName(ctx context.Context, name string) error
func (*SupervisorV2Service) StopServiceByName ¶
func (s *SupervisorV2Service) StopServiceByName(ctx context.Context, name string) error
type SvAppStateResp ¶
type SvAppStateResp struct { // Local likely always contains only one single entry where the key is the // Application ID Local map[string]ApplicationState `json:"local,omitempty"` Dependent interface{} `json:"dependent,omitempty"` Commit string `json:"commit,omitempty"` }