Documentation
¶
Overview ¶
Copyright © 2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2022-2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2022-2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Copyright © 2024 Bopmatic, LLC. All Rights Reserved. * * See LICENSE file at the root of this package for license terms
Index ¶
- Constants
- func CreateApiKey(keyName string, desc string, expireTime time.Time, opts ...DeployOption) (*pb.CreateApiKeyReply, error)
- func DeactivateProject(projId string, envId string, opts ...DeployOption) (string, error)
- func DeleteApiKey(keyId string, opts ...DeployOption) error
- func DeletePackage(packageId string, opts ...DeployOption) error
- func Describe(packageId string, opts ...DeployOption) (*pb.PackageDescription, error)
- func DescribeAllDatabases(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeDatabaseReply, error)
- func DescribeAllDatastores(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeDatastoreReply, error)
- func DescribeAllServices(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeServiceReply, error)
- func DescribeApiKey(keyId string, opts ...DeployOption) (*pb.DescribeApiKeyReply, error)
- func DescribeDatabase(projId string, envId string, dbName string, opts ...DeployOption) (*pb.DescribeDatabaseReply, error)
- func DescribeDatastore(projId string, envId string, dstoreName string, opts ...DeployOption) (*pb.DescribeDatastoreReply, error)
- func DescribeDeployment(deployId string, opts ...DeployOption) (*pb.DeploymentDescription, error)
- func DescribeProject(projId string, opts ...DeployOption) (*pb.ProjectDescription, error)
- func DescribeService(projId string, envId string, svcName string, opts ...DeployOption) (*pb.DescribeServiceReply, error)
- func DescribeSite(projId string, envId string, opts ...DeployOption) (*pb.DescribeSiteReply, error)
- func GetLogs(projId string, envId string, svcName string, startTime time.Time, ...) error
- func IsGoodProjectName(projectName string) (bool, error)
- func ListApiKeys(opts ...DeployOption) ([]string, error)
- func ListDatabases(projId string, envId string, opts ...DeployOption) ([]string, error)
- func ListDatastores(projId string, envId string, opts ...DeployOption) ([]string, error)
- func ListDeployments(projId string, envId string, opts ...DeployOption) ([]string, error)
- func ListPackages(projId string, opts ...DeployOption) ([]pb.ListPackagesReply_ListPackagesItem, error)
- func ListProjects(opts ...DeployOption) ([]string, error)
- func ListServices(projId string, envId string, opts ...DeployOption) ([]string, error)
- func RemoveStalePackages(proj *Project) error
- func RequestAccess(userName string, firstName string, lastName string, email string, ...) error
- func UnregisterProject(projId string, opts ...DeployOption) error
- type Database
- type DatabaseTable
- type DeployOption
- type Deployment
- type ObjectStore
- type Package
- type PkgOption
- type Project
- func (proj *Project) Build(stdOut io.Writer, stdErr io.Writer) error
- func (proj *Project) Deactivate(envId string, opts ...DeployOption) (string, error)
- func (proj *Project) ExportToFile(projFile string) error
- func (proj *Project) HashString() string
- func (proj *Project) IsEqual(cmpProj *Project) bool
- func (proj *Project) NewPackageCreate(pkgName string, stdOut io.Writer, stdErr io.Writer, opts ...PkgOption) (*Package, error)
- func (proj *Project) NewPackageExisting(pkgId string) (*Package, error)
- func (proj *Project) Register(opts ...DeployOption) error
- func (proj *Project) RemoveStalePackages() error
- func (proj *Project) String() string
- func (proj *Project) Unregister(opts ...DeployOption) error
- func (proj *Project) YAMLString() string
- type ProjectDesc
- type ProjectOption
- type Service
- type UserGroup
Constants ¶
const ( UserAccessAnonPublic = "anon_public" UserAccessNone = "none" )
Service is a representation of an individual service defined within a Bopmatic project. This includes its name, a short description, a link to the set of APIs it defines, and the port it should run on. Fields marked with yaml are parsed from Bopmatic.yaml while the remaining fields are derived once the project is parsed (e.g. when NewProject() returns successfully). Currently the only supported ApiDefinition format is protobuf/GRPC
const ( UserGroupTypePublic = "public" UserGroupTypePrivate = "private" )
const ( FormatVersion1_0 = "1.0" FormatVersion1_1 = "1.1" FormatVersionCurrent = FormatVersion1_1 )
Project is a full representation of a Bopmatic project, which defines a set of services to publish, their RPCs, their TCP ports to run on, and a collection of static website assets to publish. FormatVersion describes the set of supported and expected fields within a Bopmatic.yaml project description. Currently this is expected to be "1.1". Older "1.0" existing templates are also supported. This field is intended to be used for backward compatibility. Fields marked with yaml are parsed from Bopmatic.yaml while the remaining fields are derived once the project is parsed (e.g. when NewProject() returns successfully).
Differences between formatversion 1.0 and 1.1:
1.1 introduces usergroups & relationships between usersgroups and services for access control purposes. In version 1.0 as usergroups had not yet been introduced, all defined services were implictly vended with anonymous public access by default. In version 1.1, the default access is instead none.
const DefaultArtifactDir = ".bopmatic"
const DefaultProjectFilename = "Bopmatic.yaml"
const PackagesSubdir = "pkgs"
Variables ¶
This section is empty.
Functions ¶
func CreateApiKey ¶
func CreateApiKey(keyName string, desc string, expireTime time.Time, opts ...DeployOption) (*pb.CreateApiKeyReply, error)
func DeactivateProject ¶
func DeactivateProject(projId string, envId string, opts ...DeployOption) (string, error)
func DeleteApiKey ¶
func DeleteApiKey(keyId string, opts ...DeployOption) error
func DeletePackage ¶
func DeletePackage(packageId string, opts ...DeployOption) error
DeletePackage() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
func Describe ¶
func Describe(packageId string, opts ...DeployOption) (*pb.PackageDescription, error)
Describe() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
func DescribeAllDatabases ¶
func DescribeAllDatabases(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeDatabaseReply, error)
func DescribeAllDatastores ¶
func DescribeAllDatastores(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeDatastoreReply, error)
func DescribeAllServices ¶
func DescribeAllServices(projId string, envId string, opts ...DeployOption) ([]*pb.DescribeServiceReply, error)
func DescribeApiKey ¶
func DescribeApiKey(keyId string, opts ...DeployOption) (*pb.DescribeApiKeyReply, error)
func DescribeDatabase ¶
func DescribeDatabase(projId string, envId string, dbName string, opts ...DeployOption) (*pb.DescribeDatabaseReply, error)
func DescribeDatastore ¶
func DescribeDatastore(projId string, envId string, dstoreName string, opts ...DeployOption) (*pb.DescribeDatastoreReply, error)
func DescribeDeployment ¶
func DescribeDeployment(deployId string, opts ...DeployOption) (*pb.DeploymentDescription, error)
Describe() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
func DescribeProject ¶
func DescribeProject(projId string, opts ...DeployOption) (*pb.ProjectDescription, error)
func DescribeService ¶
func DescribeService(projId string, envId string, svcName string, opts ...DeployOption) (*pb.DescribeServiceReply, error)
func DescribeSite ¶
func DescribeSite(projId string, envId string, opts ...DeployOption) (*pb.DescribeSiteReply, error)
func GetLogs ¶
func GetLogs(projId string, envId string, svcName string, startTime time.Time, endTime time.Time, opts ...DeployOption) error
GetLogs() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
svcName can be left blank to retrieve logs for all services
func IsGoodProjectName ¶
func ListApiKeys ¶
func ListApiKeys(opts ...DeployOption) ([]string, error)
func ListDatabases ¶
func ListDatabases(projId string, envId string, opts ...DeployOption) ([]string, error)
func ListDatastores ¶
func ListDatastores(projId string, envId string, opts ...DeployOption) ([]string, error)
func ListDeployments ¶
func ListDeployments(projId string, envId string, opts ...DeployOption) ([]string, error)
func ListPackages ¶
func ListPackages(projId string, opts ...DeployOption) ([]pb.ListPackagesReply_ListPackagesItem, error)
ListPackages() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
func ListProjects ¶
func ListProjects(opts ...DeployOption) ([]string, error)
func ListServices ¶
func ListServices(projId string, envId string, opts ...DeployOption) ([]string, error)
func RemoveStalePackages ¶
func RequestAccess ¶
func UnregisterProject ¶
func UnregisterProject(projId string, opts ...DeployOption) error
Types ¶
type Database ¶
type Database struct { Name string `yaml:"name"` Description string `yaml:"desc,omitempty"` Tables []DatabaseTable `yaml:"tables,flow"` Services []string `yaml:"services_access,flow"` }
Database is a group of DatabaseTables accessible by one or more services. Running services may access databases by employing the DAPR state store APIs via the SDK of the user's preferred programming language. See https://docs.dapr.io/developing-applications/sdks/ for further detail.
type DatabaseTable ¶
DatabaseTable is a representation of persistent state organized by a set of related key/value pairs.
type DeployOption ¶
type DeployOption func(*deployOptions) *deployOptions
func DeployOptApiKey ¶
func DeployOptApiKey(apiKey string) DeployOption
func DeployOptBearerToken ¶
func DeployOptBearerToken(token string) DeployOption
func DeployOptHttpClient ¶
func DeployOptHttpClient(httpClient *http.Client) DeployOption
func DeployOptOutput ¶
func DeployOptOutput(output io.Writer) DeployOption
type Deployment ¶
func NewDeployment ¶
func NewDeployment(pkgId string, projId string, envId string) *Deployment
NewDeployment instantiates a new Deployment instance
func (*Deployment) Deploy ¶
func (deployment *Deployment) Deploy(opts ...DeployOption) error
func (*Deployment) Describe ¶
func (deployment *Deployment) Describe( opts ...DeployOption) (*pb.DeploymentDescription, error)
type ObjectStore ¶
type ObjectStore struct { Name string `yaml:"name"` Description string `yaml:"desc,omitempty"` Services []string `yaml:"services_access,flow"` }
ObjectStore is an object storage container accessible by one or more services. Running services may access object stores by employing the S3 APIs in the AWS SDK of the user's preferred programming language.
type Package ¶
func NewPackage ¶
func NewPackage(pkgName string, proj *Project, stdOut io.Writer, stdErr io.Writer, opts ...PkgOption) (*Package, error)
@todo add logic to avoid generating a new package when the underlying binaries haven't changed; currently this isn't happening due to the copied files in the tarball having different timestamps. Fixing this is non-trivial since golang's os.Stat() doesn't return st_atim and os.Chtimes() isn't nanosecond precision
func NewPackageFromExisting ¶
func (*Package) AbsTarballPath ¶
func (*Package) Deploy ¶
func (pkg *Package) Deploy(envId string, opts ...DeployOption) (string, error)
Deploy() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
func (*Package) Upload ¶
func (pkg *Package) Upload(opts ...DeployOption) error
Upload() implemented using a client generated with go-swagger:
https://github.com/go-swagger/go-swagger
type PkgOption ¶
type PkgOption func(*pkgOptions) *pkgOptions
func PkgOptUseHostOS ¶
func PkgOptUseHostOS() PkgOption
PkgOptUseHostOS() instructs NewProjectFromPackage() to utilize tar&xz from the host operating system directly rather than the default behavior of utilizing them via the Bopmatic Build container. It is the caller's responsibility to ensure tar&xz are installed on the host OS when utilizing this option.
type Project ¶
type Project struct { FormatVersion string `yaml:"formatversion"` Desc ProjectDesc `yaml:"project"` }
func NewProject ¶
func NewProject(projFile string, opts ...ProjectOption) (*Project, error)
NewProject instantiates a new Project instance from the specified project filename. It will parse the project file & derivative API definitions for each service defined in the project file and validate that it is well formed. Otherwise, an error is returned. Here is an example Bopmatic.yaml project file:
formatversion: "1.1" project:
name: "Foo" desc: "Foo Project" sitedir: "site" services: - name: "Greeter" desc: "Service for greeting customers" apidef: "pb/greeter.proto" port: 26001 executable: "greeter_server" useraccess: "anon_public" - name: "Orders" desc: "Service for taking customer orders" apidef: "pb/orders.proto" port: 26002 executable: "orders_server" useraccess: "CustomerUserGroup" databases: - name: "Customers" desc: "Customer database" tables: - name: "ContactDetails" desc: "Customer names, shipping address, phone, etc." - name: "Orders" desc: "Customer orders" services_access: [ "Greeter" ] object_stores: - name: "UploadBucket" desc: "Bucket for uploading data" services_access: [ "Orders" ] usergroups: - name: "CustomerUserGroup" desc: "Customer user group" type: "public"
func NewProjectFromPackage ¶
NewProjectFromPackage instantiates a new Project instance from the specified package file
func (*Project) Deactivate ¶
func (proj *Project) Deactivate(envId string, opts ...DeployOption) (string, error)
func (*Project) ExportToFile ¶
ExportToFile export Project to a new Bopmatic.yaml file
func (*Project) HashString ¶
String converts a Project into shorthand string suitable as a GUID
func (*Project) IsEqual ¶
IsEqual compares project with cmpProj to determine whether they are equivalent
func (*Project) NewPackageCreate ¶
func (proj *Project) NewPackageCreate(pkgName string, stdOut io.Writer, stdErr io.Writer, opts ...PkgOption) (*Package, error)
NewPackage collects all of the build & project artifacts required in order to submit to Bopmatic's ServiceRunner for deployment. Upon success a Package instance is returned.
func (*Project) NewPackageExisting ¶
func (*Project) Register ¶
func (proj *Project) Register(opts ...DeployOption) error
func (*Project) RemoveStalePackages ¶
RemoveStalePackages deletes any previously created project packages
func (*Project) Unregister ¶
func (proj *Project) Unregister(opts ...DeployOption) error
func (*Project) YAMLString ¶
YAMLString converts a Project into a human-friendly printable YAML string This is a replacement for yaml.Encoder.Encode which produces a much more compact strict that isn't as easy to read
type ProjectDesc ¶
type ProjectDesc struct { Name string `yaml:"name"` Id string `yaml:"id"` Description string `yaml:"desc,omitempty"` Services []Service `yaml:"services,omitempty,flow"` Databases []Database `yaml:"databases,omitempty,flow"` ObjectStores []ObjectStore `yaml:"object_stores,omitempty,flow"` UserGroups []UserGroup `yaml:"usergroups,omitempty,flow"` SiteAssets string `yaml:"sitedir,omitempty"` RuntimeConfig string `yaml:"runtime_config,omitempty"` BuildCmd string `yaml:"buildcmd"` // contains filtered or unexported fields }
ProjectDesc see Project for a complete description
func (*ProjectDesc) GetRoot ¶
func (desc *ProjectDesc) GetRoot() string
type ProjectOption ¶
type ProjectOption func(*projectOptions) *projectOptions
func ProjectOptValidateSiteAssets ¶
func ProjectOptValidateSiteAssets() ProjectOption
ProjectOptValidateSiteAssets()instructs NewProject() to validate the existence and content (e.g. whether index.html is present) of a project's specified sitedir. The default is false because projects may create sitedir at build time so it may not be present prior to a build
type Service ¶
type Service struct { Name string `yaml:"name"` Description string `yaml:"desc,omitempty"` ApiDefinition string `yaml:"apidef"` ApiDefAssets string `yaml:"apidef_assets,omitempty"` Port uint64 `yaml:"port"` Executable string `yaml:"executable"` ExecAssets string `yaml:"executable_assets,omitempty"` // The user access refers to the name of user group which is allowed to // invoke a service's APIs. The user group should either also be defined // in the same Bopmatic.yaml or refer to one of the following two built-in // user accesses: // 1. anon_public - Access to the APIs is public and does not require // any authentication. e.g. a google search // 2. none - No users are allowed to access the service directly. // e.g. an internal sales analytics service that is // only invoked by other services and not by end users // directly. This is the default. UserAccess string `yaml:"user_access,omitempty"` // contains filtered or unexported fields }
type UserGroup ¶
type UserGroup struct { Name string `yaml:"name"` Description string `yaml:"desc,omitempty"` // 2 usergroup types are currently defined: // // 1. public - membership to the group is available to the public. users // can sign themselves up without any interaction from service // administrators. e.g. a new customer can signup // at will. // 2. private - membership to the group is controlled by service // administrators. Users may not sign themselves up. e.g. // a new employee has to be onboarded by HR. Type string `yaml:"type"` }