Documentation
¶
Overview ¶
Package create provides the container config for the wrapped client. it is built to be created in a declarative way.
Index ¶
- Variables
- func IsContainerConfigError(err error) bool
- func IsHostConfigError(err error) bool
- func IsNetworkConfigError(err error) bool
- func IsPlatformConfigError(err error) bool
- func IsProjectConfigError(err error) bool
- func IsServiceConfigError(err error) bool
- type Container
- func (c *Container) Validate() error
- func (c *Container) WithContainerConfig(setters ...SetContainerConfig) *Container
- func (c *Container) WithHostConfig(setters ...SetHostConfig) *Container
- func (c *Container) WithNetworkConfig(setters ...SetNetworkConfig) *Container
- func (c *Container) WithPlatformConfig(setters ...SetPlatformConfig) *Container
- type ContainerConfigError
- type HostConfigError
- type MergedConfig
- type NetworkConfigError
- type PlatformConfigError
- type Project
- func (p *Project) Export(file string, perm os.FileMode) error
- func (p *Project) ForEachService(fn func(name string, service *types.ServiceConfig) error) error
- func (p *Project) GetService(name string) (*types.ServiceConfig, error)
- func (p *Project) Marshal() ([]byte, error)
- func (p *Project) Unwrap() *types.Project
- func (p *Project) Validate() error
- func (p *Project) WithNetwork(name string, setters ...network.SetNetworkProjectConfig) *Project
- func (p *Project) WithSecret(key string, setters ...projectsecret.SetProjectSecretConfig) *Project
- func (p *Project) WithService(name string, service *Container, setters ...SetServiceConfig) *Project
- func (p *Project) WithVolume(name string, setters ...volume.SetVolumeProjectConfig) *Project
- type ProjectConfigError
- type ServiceConfigError
- type SetContainerConfig
- type SetHostConfig
- type SetNetworkConfig
- type SetPlatformConfig
- type SetServiceConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrContainerConfig = errors.New("container config has errors") ErrHostConfig = errors.New("host config has errors") ErrNetworkConfig = errors.New("network config has errors") ErrPlatformConfig = errors.New("platform config has errors") ErrServiceConfig = errors.New("service config has errors") ErrProjectConfig = errors.New("project config has errors") ErrValidation = errors.New("container has errors") )
Functions ¶
func IsContainerConfigError ¶
func IsHostConfigError ¶
func IsNetworkConfigError ¶
func IsPlatformConfigError ¶
func IsProjectConfigError ¶
func IsServiceConfigError ¶
Types ¶
type Container ¶
type Container struct {
Name string // the name of the container
Config *MergedConfig // merged docker sdk configuration for container creation
Errors []error
}
func NewContainer ¶
func (*Container) Validate ¶
Validate validates the container config. It will return an error if the container has errors.
func (*Container) WithContainerConfig ¶
func (c *Container) WithContainerConfig(setters ...SetContainerConfig) *Container
WithContainerConfig sets the container config via the setter functions. It will return a container with the container config set. If any of the setters return an error, that setter will be skipped and an error will be appended to the container's error slice. parameters:
- setters: the setters to set the container config
func (*Container) WithHostConfig ¶
func (c *Container) WithHostConfig(setters ...SetHostConfig) *Container
WithHostConfig sets the host config via the setter functions. It will return a container with the host config set. If any of the setters return an error, that setter will be skipped and an error will be appended to the container's error slice. parameters:
- setters: the setters to set the host config
func (*Container) WithNetworkConfig ¶
func (c *Container) WithNetworkConfig(setters ...SetNetworkConfig) *Container
WithNetworkConfig sets the network config via the setter functions. It will return a container with the network config set. If any of the setters return an error, that setter will be skipped and an error will be appended to the container's error slice. parameters:
- setters: the setters to set the network config
func (*Container) WithPlatformConfig ¶
func (c *Container) WithPlatformConfig(setters ...SetPlatformConfig) *Container
WithPlatformConfig sets the platform config via the setter functions. It will return a container with the platform config set. If any of the setters return an error, that setter will be skipped and an error will be appended to the container's error slice. parameters:
- setters: the setters to set the platform config
type ContainerConfigError ¶
func NewContainerConfigError ¶
func NewContainerConfigError(field, message string) *ContainerConfigError
func (*ContainerConfigError) Error ¶
func (e *ContainerConfigError) Error() string
func (*ContainerConfigError) Unwrap ¶
func (e *ContainerConfigError) Unwrap() error
type HostConfigError ¶
func NewHostConfigError ¶
func NewHostConfigError(field, message string) *HostConfigError
func (*HostConfigError) Error ¶
func (e *HostConfigError) Error() string
func (*HostConfigError) Unwrap ¶
func (e *HostConfigError) Unwrap() error
type MergedConfig ¶ added in v0.1.3
type MergedConfig struct {
Container *container.Config // the container configuration
Host *container.HostConfig // the host configuration
Network *network.NetworkingConfig // the network configuration
Platform *ocispec.Platform // the platform configuration
}
type NetworkConfigError ¶
func NewNetworkConfigError ¶
func NewNetworkConfigError(field, message string) *NetworkConfigError
func (*NetworkConfigError) Error ¶
func (e *NetworkConfigError) Error() string
func (*NetworkConfigError) Unwrap ¶
func (e *NetworkConfigError) Unwrap() error
type PlatformConfigError ¶
func NewPlatformConfigError ¶
func NewPlatformConfigError(field, message string) *PlatformConfigError
func (*PlatformConfigError) Error ¶
func (e *PlatformConfigError) Error() string
func (*PlatformConfigError) Unwrap ¶
func (e *PlatformConfigError) Unwrap() error
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project is a wrapper around types.Project It provides methods to create and manage a docker Compose project.
func NewProject ¶
NewProject creates a new project with the given name. It initializes the project with an empty service list. The name is used as the project name in the compose file.
func (*Project) Export ¶
Export exports the project to a file parameters:
- file: the file path to export the project to
- perm: the permission of the file
func (*Project) ForEachService ¶
ForEachService iterates over each service in the project and calls the provided function to provide the ability to mutate a service parameters:
- fn: the function to call for each service
returns an error if the function returns an error
func (*Project) GetService ¶ added in v0.1.3
func (p *Project) GetService(name string) (*types.ServiceConfig, error)
GetService returns a service from the project parameters:
- name: the name of the service
returns the service and an error if the service is not found or the project has no services
func (*Project) Validate ¶
Validate validates the project returns an error if the project has errors
func (*Project) WithNetwork ¶
func (p *Project) WithNetwork(name string, setters ...network.SetNetworkProjectConfig) *Project
WithNetwork defines a new network in the project
func (*Project) WithSecret ¶
func (p *Project) WithSecret(key string, setters ...projectsecret.SetProjectSecretConfig) *Project
WithSecret defines a new secret in the project
func (*Project) WithService ¶
func (p *Project) WithService(name string, service *Container, setters ...SetServiceConfig) *Project
WithService defines a new service in the project parameters:
- name: the name of the service
- service: the container to create the service from
- setters: the setters to apply to the service
func (*Project) WithVolume ¶
func (p *Project) WithVolume(name string, setters ...volume.SetVolumeProjectConfig) *Project
WithVolume defines a new volume in the project parameters:
- name: the name of the volume
- volume: the volume to create the volume from
type ProjectConfigError ¶
func NewProjectConfigError ¶
func NewProjectConfigError(field, message string) *ProjectConfigError
func (*ProjectConfigError) Error ¶
func (e *ProjectConfigError) Error() string
func (*ProjectConfigError) Unwrap ¶
func (e *ProjectConfigError) Unwrap() error
type ServiceConfigError ¶
func NewServiceConfigError ¶
func NewServiceConfigError(field, message string) *ServiceConfigError
func (*ServiceConfigError) Error ¶
func (e *ServiceConfigError) Error() string
func (*ServiceConfigError) Unwrap ¶
func (e *ServiceConfigError) Unwrap() error
type SetContainerConfig ¶
SetContainerConfig is a function that sets the container config
type SetHostConfig ¶
type SetHostConfig func(config *container.HostConfig) error
SetHostConfig is a function that sets the host config
type SetNetworkConfig ¶
type SetNetworkConfig func(config *network.NetworkingConfig) error
SetNetworkConfig is a function that sets the network config
type SetPlatformConfig ¶
SetPlatformConfig is a function that sets the platform config
type SetServiceConfig ¶
type SetServiceConfig func(service *types.ServiceConfig) error
SetServiceConfig is a function that sets the service config
Directories
¶
| Path | Synopsis |
|---|---|
|
config
|
|
|
cc
Package cc provides the options for the container config.
|
Package cc provides the options for the container config. |
|
hc
Package hc provides the options for the host config.
|
Package hc provides the options for the host config. |
|
hc/mount
Package mount provides the options for the mount config in the host config.
|
Package mount provides the options for the mount config in the host config. |
|
nc
Package nc provides the options for the network config.
|
Package nc provides the options for the network config. |
|
nc/endpoint
Package endpoint provides the options for the endpoint config in the network config.
|
Package endpoint provides the options for the endpoint config in the network config. |
|
nc/endpoint/ipam
Package ipam provides the options for the IPAM config in the endpoint config.
|
Package ipam provides the options for the IPAM config in the endpoint config. |
|
pc
Package pc provides the options for the platform config.
|
Package pc provides the options for the platform config. |
|
sc
Package sc provides functions to set the service config
|
Package sc provides functions to set the service config |
|
sc/build
Package build provides functions to set the build config for a service
|
Package build provides functions to set the build config for a service |
|
sc/build/ulimit
Package ulimit provides a set of functions to configure the ulimits for the build
|
Package ulimit provides a set of functions to configure the ulimits for the build |
|
sc/deploy
Package deploy provides functions to set the deploy configuration for a service
|
Package deploy provides functions to set the deploy configuration for a service |
|
sc/deploy/resource
Package resource provides functions to set the resource configuration for a service deploy
|
Package resource provides functions to set the resource configuration for a service deploy |
|
sc/deploy/resource/device
Package device provides functions to set the device configuration for a service deploys resource
|
Package device provides functions to set the device configuration for a service deploys resource |
|
sc/deploy/update
Package update provides functions to set the update configuration for a service deploy
|
Package update provides functions to set the update configuration for a service deploy |
|
sc/network
Package network provides functions to set the network configuration for a project
|
Package network provides functions to set the network configuration for a project |
|
sc/network/pool
Package pool provides functions to set the ipam pool configuration for a project
|
Package pool provides functions to set the ipam pool configuration for a project |
|
sc/secrets/projectsecret
Package projectsecret provides a set of functions to configure the secret for the project
|
Package projectsecret provides a set of functions to configure the secret for the project |
|
sc/secrets/secretservice
Package secretservice provides a set of functions to configure the secrets for the service
|
Package secretservice provides a set of functions to configure the secrets for the service |
|
sc/volume
Package volume provides functions to set the volume configuration for a project
|
Package volume provides functions to set the volume configuration for a project |