### Get Build and Launch SBoM paths Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods to retrieve SBoM paths for build and launch phases. ```go func (l Layers) BuildSBOMPath(bt SBOMFormat) string ``` ```go func (l Layers) LaunchSBOMPath(bt SBOMFormat) string ``` -------------------------------- ### Install libcnb Go Package Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Use this command to install the libcnb package for your Go project. Ensure you have Go installed and configured. ```go go get github.com/buildpacks/libcnb ``` -------------------------------- ### Get Layer SBoM path Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Retrieves the path to the SBoM file for a specific layer. ```go func (l Layer) SBOMPath(bt SBOMFormat) string ``` -------------------------------- ### Get SBOM Format Media Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Returns the media type string for a given SBOMFormat. Use this when setting HTTP headers or configuring systems that require media types. ```go func (b SBOMFormat) MediaType() string ``` -------------------------------- ### Exec Type and Methods Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the exec.d layer location and provides methods to get file paths. ```APIDOC ## type Exec ¶ added in v1.16.0 ### Description Exec represents the exec.d layer location. ### Fields - **Path** (string) - The path to the exec.d directory. ## func (Exec) FilePath ¶ added in v1.16.0 ### Description FilePath returns the fully qualified file path for a given name. ### Signature ```go func (e Exec) FilePath(name string) string ``` ## func (Exec) ProcessFilePath ¶ added in v1.16.0 ### Description ProcessFilePath returns the fully qualified file path for a given name. ### Signature ```go func (e Exec) ProcessFilePath(processType string, name string) string ``` ``` -------------------------------- ### Configuration options Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Various options for configuring buildpack behavior. ```go func WithArguments(arguments []string) Option ``` ```go func WithBOMLabel(bomLabel bool) Option ``` ```go func WithEnvironmentWriter(environmentWriter EnvironmentWriter) Option ``` ```go func WithExecDWriter(execdWriter ExecDWriter) Option ``` ```go func WithExitHandler(exitHandler ExitHandler) Option ``` ```go func WithTOMLWriter(tomlWriter TOMLWriter) Option ``` -------------------------------- ### Create a new layer Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Creates a layer instance and loads existing metadata. ```go func (l *Layers) Layer(name string) (Layer, error) ``` -------------------------------- ### Layers.LaunchSBOMPath Method Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Returns the full path to the launch SBOM file for the buildpack. ```APIDOC ## func (Layers) LaunchSBOMPath ¶ added in v1.25.0 ### Signature ```go func (l Layers) LaunchSBOMPath(bt SBOMFormat) string ``` ### Description BOMLaunchPath returns the full path to the launch SBoM file for the buildpack. ``` -------------------------------- ### Define License structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Contains licensing information for a buildpack. ```go type License struct { // Type is the identifier for the license. // It MAY use the SPDX 2.1 license expression, but is not limited to identifiers in the SPDX Licenses List. Type string `toml:"type"` // URI may be specified in lieu of or in addition to type to point to the license // if this buildpack is using a nonstandard license. URI string `toml:"uri"` } ``` -------------------------------- ### Set default environment variables Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for setting default values for environment variables. ```go func (e Environment) Default(name string, a ...interface{}) ``` ```go func (e Environment) Defaultf(name string, format string, a ...interface{}) ``` -------------------------------- ### Prepend environment variables Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for prepending values to environment variables. ```go func (e Environment) Prepend(name string, delimiter string, a ...interface{}) ``` ```go func (e Environment) Prependf(name string, delimiter string, format string, a ...interface{}) ``` -------------------------------- ### Define Platform structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the contents of the platform directory. ```go type Platform struct { // Bindings are the external bindings available to the application. Bindings Bindings // Environment is the environment exposed by the platform. Environment map[string]string // Path is the path to the platform. Path string } ``` -------------------------------- ### Add Entry to Profile Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Adds an entry to a .profile.d file using default formatting for operands. Spaces are inserted between operands if neither is a string. ```go func (p Profile) Add(name string, a ...interface{}) ``` -------------------------------- ### Define a Detector interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Implement this interface to define custom buildpack detection logic. ```go type Detector interface { // Detect takes a context and returns a result, performing buildpack detect behaviors. Detect(context DetectContext) (DetectResult, error) } ``` -------------------------------- ### Define LayerTypes structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Describes the build, cache, and launch applicability of a layer. ```go type LayerTypes struct { // Build indicates that a layer should be used for builds. Build bool `toml:"build"` // Cache indicates that a layer should be cached. Cache bool `toml:"cache"` // Launch indicates that a layer should be used for launch. Launch bool `toml:"launch"` } ``` -------------------------------- ### Layers.BuildSBOMPath Method Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Returns the full path to the build SBOM file for the buildpack. ```APIDOC ## func (Layers) BuildSBOMPath ¶ added in v1.25.0 ### Signature ```go func (l Layers) BuildSBOMPath(bt SBOMFormat) string ``` ### Description BOMBuildPath returns the full path to the build SBoM file for the buildpack. ``` -------------------------------- ### Buildpack Configuration Structures Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Definitions for buildpack.toml contents, including Buildpack, BuildpackInfo, and BuildpackOrder structures. ```APIDOC ## Buildpack Configuration Structures ### Description These structures represent the configuration files and metadata required for Cloud Native Buildpacks, specifically mapping to buildpack.toml. ### Data Structures - **Buildpack**: Represents the root contents of buildpack.toml. - **API** (string) - API version expected by the buildpack. - **Info** (BuildpackInfo) - Information about the buildpack. - **Path** (string) - Path to the buildpack. - **Stacks** ([]BuildpackStack) - Supported stacks. - **Metadata** (map[string]interface{}) - Arbitrary metadata. - **BuildpackInfo**: Metadata about the buildpack. - **ID** (string) - Buildpack ID. - **Name** (string) - Buildpack name. - **Version** (string) - Buildpack version. - **Homepage** (string) - Homepage URL. - **ClearEnvironment** (bool) - Whether to clear user-configured environment variables. - **Description** (string) - Description of the buildpack. - **Keywords** ([]string) - Associated keywords. - **Licenses** ([]License) - List of licenses. - **SBOMFormats** ([]string) - Supported SBOM media types. ``` -------------------------------- ### Define a Process Struct Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Defines the structure for a process, including its type, command, arguments, and execution details. Use this to configure how a process runs. ```go type Process struct { // Type is the type of the process. Type string `toml:"type"` // Command is the command of the process. Command string `toml:"command"` // Arguments are arguments to the command. Arguments []string `toml:"args"` // Command is exec'd directly by the os (no profile.d scripts run) Direct bool `toml:"direct,omitempty"` // WorkingDirectory is a directory to execute the command in, removes the need to use a shell environment to CD into working directory WorkingDirectory string `toml:"working-dir,omitempty"` // Default can be set to true to indicate that the process // type being defined should be the default process type for the app image. Default bool `toml:"default,omitempty"` } ``` -------------------------------- ### Add Formatted Process Entry to Profile Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Adds a formatted entry to a .profile.d file for a specific process type. Use this for advanced control over the content of process-specific profile scripts. ```go func (p Profile) ProcessAddf(processType string, name string, format string, a ...interface{}) ``` -------------------------------- ### String representation of SBOMFormat Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Returns the string representation of an SBOMFormat. This is helpful for logging or displaying the format in a human-readable way. ```go func (b SBOMFormat) String() string ``` -------------------------------- ### Add Process Entry to Profile Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Adds an entry to a .profile.d file for a specific process type, using default formatting. This is useful for setting environment variables or configurations specific to a process. ```go func (p Profile) ProcessAdd(processType string, name string, a ...interface{}) ``` -------------------------------- ### Binding Management Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Utilities for creating and managing service bindings used by buildpacks. ```APIDOC ## func NewBinding ### Description Creates a new Binding initialized with a secret. ### Parameters - **name** (string) - Required - The name of the binding. - **path** (string) - Required - The path to the binding directory. - **secret** (map[string]string) - Required - The secret data. ## func NewBindingFromPath ### Description Creates a new binding from the files located at a path. ### Parameters - **path** (string) - Required - The path to the binding directory. ### Response - **Binding** (Binding) - The created binding object. - **error** (error) - Error if the binding could not be created. ``` -------------------------------- ### LaunchTOML Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the contents of a launch.toml file, including labels, processes, slices, and BOM. ```APIDOC ## type LaunchTOML ¶ added in v1.19.0 ### Description LaunchTOML represents the contents of launch.toml. ### Fields - **Labels** ([]Label) - The collection of image labels contributed by the buildpack. - **Processes** ([]Process) - The collection of process types contributed by the buildpack. - **Slices** ([]Slice) - The collection of slices contributed by the buildpack. - **BOM** ([]BOMEntry) - A collection of entries for the bill of materials. Deprecated: as of Buildpack API 0.7, write to `layer.BOMPath()` instead. ``` -------------------------------- ### PlatformFormatter.String Method Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Returns a string representation of the PlatformFormatter. ```APIDOC ## func (PlatformFormatter) String ¶ ### Signature ```go func (p PlatformFormatter) String() string ``` ``` -------------------------------- ### Buildpack Lifecycle Functions Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Core functions for executing the buildpack lifecycle phases: Detect, Build, and Main. ```APIDOC ## func Detect ### Description Executes the detection phase of the buildpack lifecycle. ### Parameters - **detector** (Detector) - Required - The detector implementation. - **options** (...Option) - Optional - Configuration options for the detection process. ## func Build ### Description Executes the build phase of the buildpack lifecycle. ### Parameters - **builder** (Builder) - Required - The builder implementation. - **options** (...Option) - Optional - Configuration options for the build process. ## func Main ### Description Entry point for the buildpack, executing both detection and build phases. ### Parameters - **detector** (Detector) - Required - The detector implementation. - **builder** (Builder) - Required - The builder implementation. - **options** (...Option) - Optional - Configuration options. ``` -------------------------------- ### Layers.Layer Method Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Creates a new layer, loading metadata if it exists. ```APIDOC ## func (*Layers) Layer ¶ ### Signature ```go func (l *Layers) Layer(name string) (Layer, error) ``` ### Description Layer creates a new layer, loading metadata if it exists. ``` -------------------------------- ### Option Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc A function for configuring a Config instance. ```APIDOC ## type Option Option is a function for configuring a Config instance. ``` -------------------------------- ### Define PlatformFormatter Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Formatter for the Platform structure. ```go type PlatformFormatter Platform ``` ```go func (p PlatformFormatter) String() string ``` -------------------------------- ### Store Struct Definition Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the contents of store.toml, including persistent metadata. Use this to manage application or buildpack metadata. ```go type Store struct { // Metadata represents the persistent metadata. Metadata map[string]interface{} `toml:"metadata"` } ``` -------------------------------- ### Platform Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the contents of the platform directory, including bindings, environment, and path. ```APIDOC ## type Platform Platform is the contents of the platform directory. ### Fields - **Bindings** (Bindings) - Bindings are the external bindings available to the application. - **Environment** (map[string]string) - Environment is the environment exposed by the platform. - **Path** (string) - Path is the path to the platform. ``` -------------------------------- ### Buildpack Lifecycle Functions Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions used to execute the lifecycle phases of a buildpack, including detection, building, and running execd binaries. ```APIDOC ## func Build ### Description Build is called by the main function of a buildpack, for build. ### Parameters - **builder** (Builder) - Required - The builder implementation. - **options** (...Option) - Optional - Configuration options. ## func Detect ### Description Detect is called by the main function of a buildpack, for detection. ### Parameters - **detector** (Detector) - Required - The detector implementation. - **options** (...Option) - Optional - Configuration options. ## func Main ### Description Main is called by the main function of a buildpack, encapsulating both detection and build in the same binary. ### Parameters - **detector** (Detector) - Required - The detector implementation. - **builder** (Builder) - Required - The builder implementation. - **options** (...Option) - Optional - Configuration options. ## func RunExecD ### Description RunExecD is called by the main function of a buildpack's execd binary, encompassing multiple execd executors in one binary. ### Parameters - **execDMap** (map[string]ExecD) - Required - Map of execd executors. - **options** (...Option) - Optional - Configuration options. ``` -------------------------------- ### Environment Process Prepend Functions Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc These functions allow prepending values to existing environment variables for a specific process type. They format the new value and add it to the beginning of the existing value. ```APIDOC ## func (Environment) ProcessPrepend ¶ added in v1.14.0 ### Description ProcessPrepend formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. Spaces are added between operands when neither is a string. If delimitation is important during concatenation, callers are required to add it. ### Signature ```go func (e Environment) ProcessPrepend(processType string, name string, delimiter string, a ...interface{}) ``` ## func (Environment) ProcessPrependf ¶ added in v1.14.0 ### Description ProcessPrependf formats using the default formats for its operands and prepends the value of this environment variable to any previous declarations of the value without any delimitation. If delimitation is important during concatenation, callers are required to add it. ### Signature ```go func (e Environment) ProcessPrependf(processType string, name string, delimiter string, format string, a ...interface{}) ``` ``` -------------------------------- ### Add Formatted Entry to Profile Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Adds a formatted entry to a .profile.d file. Use this when specific formatting is required for the entry's content. ```go func (p Profile) Addf(name string, format string, a ...interface{}) ``` -------------------------------- ### Define Layers structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the layers directory structure. ```go type Layers struct { // Path is the layers filesystem location. Path string } ``` -------------------------------- ### Append environment variables Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for appending values to environment variables. ```go func (e Environment) Append(name string, delimiter string, a ...interface{}) ``` ```go func (e Environment) Appendf(name string, delimiter string, format string, a ...interface{}) ``` -------------------------------- ### Define an Environment map Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the file-based environment variable specification. ```go type Environment map[string]string ``` -------------------------------- ### Define Layer structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents a layer managed by the buildpack, including metadata and environment configurations. ```go type Layer struct { // LayerTypes indicates the type of layer LayerTypes `toml:"types"` // Metadata is the metadata associated with the layer. Metadata map[string]interface{} `toml:"metadata"` // Name is the name of the layer. Name string `toml:"-"` // Path is the filesystem location of the layer. Path string `toml:"-"` // BuildEnvironment are the environment variables set at build time. BuildEnvironment Environment `toml:"-"` // LaunchEnvironment are the environment variables set at launch time. LaunchEnvironment Environment `toml:"-"` // SharedEnvironment are the environment variables set at both build and launch times. SharedEnvironment Environment `toml:"-"` // Profile is the profile.d scripts set in the layer. Profile Profile `toml:"-"` // Exec is the exec.d executables set in the layer. Exec Exec `toml:"-"` } ``` -------------------------------- ### Detection Context and Results Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Structures used during the detection phase of the buildpack lifecycle. ```APIDOC ## Detection Context and Results ### Description Structures defining the inputs and outputs for the detection phase. ### Data Structures - **DetectContext**: - **Application** (Application) - The application to build. - **Buildpack** (Buildpack) - Metadata from buildpack.toml. - **Platform** (Platform) - Contents of the platform. - **StackID** (string) - ID of the stack. - **DetectResult**: - **Pass** (bool) - Indicates whether detection has passed. - **Plans** ([]BuildPlan) - Build plans contributed by the buildpack. ``` -------------------------------- ### Process Metadata Structure Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Defines the structure for process metadata used in buildpacks. ```APIDOC ## Process Structure ### Description Process represents metadata about a type of command that can be run. ### Fields - **Type** (string) - The type of the process. - **Command** (string) - The command of the process. - **Arguments** ([]string) - Arguments to the command. - **Direct** (bool) - Command is exec'd directly by the os (no profile.d scripts run). - **WorkingDirectory** (string) - A directory to execute the command in. - **Default** (bool) - Indicates if the process type should be the default process type for the app image. ``` -------------------------------- ### License Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Contains information about a Software License governing the use or redistribution of a buildpack. ```APIDOC ## type License ¶ added in v1.20.0 License contains information about a Software License governing the use or redistribution of a buildpack. ### Fields - **Type** (string) - The identifier for the license. It MAY use the SPDX 2.1 license expression, but is not limited to identifiers in the SPDX Licenses List. - **URI** (string) - URI may be specified in lieu of or in addition to type to point to the license if this buildpack is using a nonstandard license. ``` -------------------------------- ### Define Option type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functional option for configuring a Config instance. ```go type Option func(config Config) Config ``` -------------------------------- ### Option Functions Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions that return Option types for configuring Config instances. ```APIDOC ## func WithArguments ### Signature ```go func WithArguments(arguments []string) Option ``` ### Description WithArguments creates an Option that sets a collection of arguments. ``` ```APIDOC ## func WithBOMLabel ¶ added in v1.25.5 ### Signature ```go func WithBOMLabel(bomLabel bool) Option ``` ### Description WithBOMLabel creates an Option that enables/disables writing the BOM Label. Deprecated: as of Buildpack API 0.7, to be removed in a future version. ``` ```APIDOC ## func WithEnvironmentWriter ### Signature ```go func WithEnvironmentWriter(environmentWriter EnvironmentWriter) Option ``` ### Description WithEnvironmentWriter creates an Option that sets an EnvironmentWriter implementation. ``` ```APIDOC ## func WithExecDWriter ¶ added in v1.24.0 ### Signature ```go func WithExecDWriter(execdWriter ExecDWriter) Option ``` ### Description WithExecDWriter creates an Option that sets a ExecDWriter implementation. ``` ```APIDOC ## func WithExitHandler ### Signature ```go func WithExitHandler(exitHandler ExitHandler) Option ``` ### Description WithExitHandler creates an Option that sets an ExitHandler implementation. ``` ```APIDOC ## func WithTOMLWriter ### Signature ```go func WithTOMLWriter(tomlWriter TOMLWriter) Option ``` ### Description WithTOMLWriter creates an Option that sets a TOMLWriter implementation. ``` -------------------------------- ### Profile Management Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for managing profile.d entries. ```APIDOC ## Profile Management ### Description Profile is a collection of values to be written into profile.d files. ### Methods - **Add(name string, a ...interface{})** - Formats using default formats and adds an entry. - **Addf(name string, format string, a ...interface{})** - Formats according to a format specifier and adds an entry. - **ProcessAdd(processType string, name string, a ...interface{})** - Adds an entry for a specific process type. - **ProcessAddf(processType string, name string, format string, a ...interface{})** - Adds a formatted entry for a specific process type. ``` -------------------------------- ### Environment Management Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions for manipulating environment variables during the build process. ```APIDOC ## type Environment ### Description Provides methods to modify environment variables, including appending, prepending, and overriding values. ### Methods - **Append(name string, delimiter string, a ...interface{})** - Appends values to an environment variable. - **Prepend(name string, delimiter string, a ...interface{})** - Prepends values to an environment variable. - **Override(name string, a ...interface{})** - Overrides an environment variable value. - **Default(name string, a ...interface{})** - Sets a default value for an environment variable. ``` -------------------------------- ### Build Result API Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions for initializing build results used during the buildpack execution process. ```APIDOC ## NewBuildResult ### Description Creates a new BuildResult instance, initializing empty fields. ### Response - **BuildResult** (object) - The initialized build result structure. ``` -------------------------------- ### Convert String to SBOMFormat Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Converts a string representation to an SBOMFormat. This is useful for parsing user input or configuration files that specify SBOM formats. ```go func SBOMFormatFromString(from string) (SBOMFormat, error) ``` -------------------------------- ### Layer.SBOMPath Method Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Retrieves the SBOM path for a given layer. ```APIDOC ## func (Layer) SBOMPath ¶ added in v1.25.0 ### Signature ```go func (l Layer) SBOMPath(bt SBOMFormat) string ``` ### Description Returns the SBOM path for the layer. ``` -------------------------------- ### Environment Type and Methods Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc The Environment type is a map used for specifying file-based environment variables. It provides methods to append, default, override, and prepend environment variable values, with variations for formatted strings and process-specific settings. ```APIDOC ## Environment Type ### Description The Environment type represents the file-based environment variable specification. It is a map of strings to strings. ### Methods #### Append ```go func (e Environment) Append(name string, delimiter string, a ...interface{}) ``` Appends the value of an environment variable to any previous declarations without delimitation. Spaces are added between operands when neither is a string. #### Appendf ```go func (e Environment) Appendf(name string, delimiter string, format string, a ...interface{}) ``` Formats according to a format specifier and appends the value of an environment variable to any previous declarations without delimitation. #### Default ```go func (e Environment) Default(name string, a ...interface{}) ``` Formats using the default formats for its operands and sets a default for an environment variable with this value. Spaces are added between operands when neither is a string. #### Defaultf ```go func (e Environment) Defaultf(name string, format string, a ...interface{}) ``` Formats according to a format specifier and sets a default for an environment variable with this value. #### Override ```go func (e Environment) Override(name string, a ...interface{}) ``` Formats using the default formats for its operands and overrides any existing value for an environment variable with this value. Spaces are added between operands when neither is a string. #### Overridef ```go func (e Environment) Overridef(name string, format string, a ...interface{}) ``` Formats according to a format specifier and overrides any existing value for an environment variable with this value. #### Prepend ```go func (e Environment) Prepend(name string, delimiter string, a ...interface{}) ``` Formats using the default formats for its operands and prepends the value of an environment variable to any previous declarations without delimitation. Spaces are added between operands when neither is a string. #### Prependf ```go func (e Environment) Prependf(name string, delimiter string, format string, a ...interface{}) ``` Formats using the default formats for its operands and prepends the value of an environment variable to any previous declarations without delimitation. If delimitation is important during concatenation, callers are required to add it. #### ProcessAppend ```go func (e Environment) ProcessAppend(processType string, name string, delimiter string, a ...interface{}) ``` Formats using the default formats for its operands and appends the value of an environment variable to any previous declarations without delimitation. Spaces are added between operands when neither is a string. #### ProcessAppendf ```go func (e Environment) ProcessAppendf(processType string, name string, delimiter string, format string, a ...interface{}) ``` Formats according to a format specifier and appends the value of an environment variable to any previous declarations without delimitation. If delimitation is important during concatenation, callers are required to add it. #### ProcessDefault ```go func (e Environment) ProcessDefault(processType string, name string, a ...interface{}) ``` Formats using the default formats for its operands and sets a default for an environment variable with this value. Spaces are added between operands when neither is a string. #### ProcessDefaultf ```go func (e Environment) ProcessDefaultf(processType string, name string, format string, a ...interface{}) ``` Formats according to a format specifier and sets a default for an environment variable with this value. ``` -------------------------------- ### Binding Management API Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions for creating and managing service bindings from various sources like environment variables or file paths. ```APIDOC ## NewBindingsForBuild ### Description Creates a new bindings collection from the path defined by $SERVICE_BINDING_ROOT or $CNB_BINDINGS. ### Parameters #### Arguments - **platformDir** (string) - Required - The platform directory path. ### Response - **Bindings** (object) - A collection of bindings. - **error** (error) - Error if the operation fails. ``` ```APIDOC ## NewBindingsForLaunch ### Description Creates a new bindings collection from the path defined by $SERVICE_BINDING_ROOT or $CNB_BINDINGS. If neither is defined, returns an empty collection. ### Response - **Bindings** (object) - A collection of bindings. - **error** (error) - Error if the operation fails. ``` ```APIDOC ## NewBindingsFromVcapServicesEnv ### Description Creates a new instance from all the bindings provided via VCAP_SERVICES. ### Parameters #### Arguments - **content** (string) - Required - The VCAP_SERVICES content string. ### Response - **Bindings** (object) - A collection of bindings. - **error** (error) - Error if the operation fails. ``` -------------------------------- ### UnmetPlanEntry Struct Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Denotes an unmet buildpack plan entry, indicating a dependency that was not satisfied. Use this to signal unmet requirements to subsequent buildpack providers. ```go type UnmetPlanEntry struct { // Name represents the name of the entry. Name string `toml:"name"` } ``` -------------------------------- ### PlatformFormatter Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc The formatter for a Platform. ```APIDOC ## type PlatformFormatter PlatformFormatter is the formatter for a Platform. ``` -------------------------------- ### Detector Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc The Detector interface is used by the Detect function to perform buildpack detect behaviors. It requires a context and returns a result or an error. ```APIDOC ## Detector Interface ### Description The Detector interface is used by the Detect function to perform buildpack detect behaviors. It requires a context and returns a result or an error. ### Type `Detector` ### Methods - `Detect(context DetectContext) (DetectResult, error)`: Performs buildpack detect behaviors. ``` -------------------------------- ### SBOMFormat Utility Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Functions for handling Software Bill of Materials (SBOM) formats. ```APIDOC ## SBOMFormat ### Description BOMFormat indicates the format of the SBOM entry. ### Functions - **SBOMFormatFromString(from string) (SBOMFormat, error)** - Converts a string to an SBOMFormat. - **MediaType() string** - Returns the media type for the format. - **String() string** - Returns the string representation of the format. ``` -------------------------------- ### Layer Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents a layer managed by the buildpack, including its types, metadata, name, path, and environment variables. ```APIDOC ## type Layer Layer represents a layer managed by the buildpack. ### Fields - **LayerTypes** (LayerTypes) - LayerTypes indicates the type of layer. - **Metadata** (map[string]interface{}) - Metadata is the metadata associated with the layer. - **Name** (string) - Name is the name of the layer. - **Path** (string) - Path is the filesystem location of the layer. - **BuildEnvironment** (Environment) - BuildEnvironment are the environment variables set at build time. - **LaunchEnvironment** (Environment) - LaunchEnvironment are the environment variables set at launch time. - **SharedEnvironment** (Environment) - SharedEnvironment are the environment variables set at both build and launch times. - **Profile** (Profile) - Profile is the profile.d scripts set in the layer. - **Exec** (Exec) - Exec is the exec.d executables set in the layer. ``` -------------------------------- ### Override environment variables Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for overriding existing environment variable values. ```go func (e Environment) Override(name string, a ...interface{}) ``` ```go func (e Environment) Overridef(name string, format string, a ...interface{}) ``` -------------------------------- ### ExitHandler Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for handling buildpack exit behavior. ```APIDOC ## type ExitHandler ¶ ### Description ExitHandler is the interface implemented by a type that wants to handle exit behavior when a buildpack encounters an error. ### Interface Methods #### Error ##### Description Error is called when an error is encountered. ##### Signature ```go func (ExitHandler) Error(error) ``` #### Fail ##### Description Fail is called when a buildpack fails. ##### Signature ```go func (ExitHandler) Fail() ``` #### Pass ##### Description Pass is called when a buildpack passes. ##### Signature ```go func (ExitHandler) Pass() ``` ``` -------------------------------- ### LayerTypes Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Describes the types applicable to a layer, including Build, Cache, and Launch. ```APIDOC ## type LayerTypes ¶ added in v1.19.0 LayerTypes describes which types apply to a given layer. A layer may have any combination of Launch, Build, and Cache types. ### Fields - **Build** (bool) - Indicates that a layer should be used for builds. - **Cache** (bool) - Indicates that a layer should be cached. - **Launch** (bool) - Indicates that a layer should be used for launch. ``` -------------------------------- ### SBOM Format Enumeration Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Defines an integer enumeration for SBOM formats. Use this to specify or identify the format of Software Bill of Materials data. ```go type SBOMFormat int ``` ```go const ( CycloneDXJSON SBOMFormat = iota SPDXJSON SyftJSON UnknownFormat ) ``` -------------------------------- ### Builder Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc The Builder interface defines the contract for performing buildpack build behaviors. ```APIDOC ## Builder Interface ### Description Builder describes an interface for types that can be used by the Build function to perform buildpack build behaviors. ### Method - **Build(context BuildContext) (BuildResult, error)**: Takes a context and returns a result. ``` -------------------------------- ### ExecD Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for types that follow the Exec.d specification, returning environment variables. ```APIDOC ## type ExecD ¶ added in v1.24.0 ### Description ExecD describes an interface for types that follow the Exec.d specification. It should return a map of environment variables and their values as output. ### Interface Methods #### Execute ##### Description Execute returns a map of environment variables and their values. ##### Signature ```go func (ExecD) Execute() (map[string]string, error) ``` ``` -------------------------------- ### Profile Type Definition Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents a collection of values to be written into profile.d files. This type is a map where keys are filenames and values are their content. ```go type Profile map[string]string ``` -------------------------------- ### Process-specific environment variable operations Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Methods for manipulating environment variables scoped to a specific process type. ```go func (e Environment) ProcessAppend(processType string, name string, delimiter string, a ...interface{}) ``` ```go func (e Environment) ProcessAppendf(processType string, name string, delimiter string, format string, a ...interface{}) ``` ```go func (e Environment) ProcessDefault(processType string, name string, a ...interface{}) ``` ```go func (e Environment) ProcessDefaultf(processType string, name string, format string, a ...interface{}) ``` -------------------------------- ### TOMLWriter Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for types that can serialize an object to a TOML file. Implement this to provide custom TOML writing logic. ```go type TOMLWriter interface { // Write is called with the path that a TOML file should be written to and the object to serialize to that file. Write(path string, value interface{}) error } ``` -------------------------------- ### EnvironmentWriter Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for types that serialize environment variables to the file system. ```APIDOC ## type EnvironmentWriter ¶ ### Description EnvironmentWriter is the interface implemented by a type that wants to serialize a map of environment variables to the file system. ### Interface Methods #### Write ##### Description Write is called with the path to a directory where the environment variables should be serialized to and the environment variables to serialize to that directory. ##### Signature ```go func (EnvironmentWriter) Write(dir string, environment map[string]string) error ``` ``` -------------------------------- ### Slice Struct Definition Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents metadata about a slice, containing a list of paths. Use this to define collections of file paths. ```go type Slice struct { // Paths are the contents of the slice. Paths []string `toml:"paths"` } ``` -------------------------------- ### Layers Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents the layers part of the specification, including its filesystem path. ```APIDOC ## type Layers Layers represents the layers part of the specification. ### Fields - **Path** (string) - Path is the layers filesystem location. ``` -------------------------------- ### Environment Process Override Functions Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc These functions allow overriding environment variables for a specific process type. They format the new value and replace any existing value. ```APIDOC ## func (Environment) ProcessOverride ¶ added in v1.14.0 ### Description ProcessOverride formats using the default formats for its operands and overrides any existing value for an environment variable with this value. Spaces are added between operands when neither is a string. ### Signature ```go func (e Environment) ProcessOverride(processType string, name string, a ...interface{}) ``` ## func (Environment) ProcessOverridef ¶ added in v1.14.0 ### Description ProcessOverridef formats according to a format specifier and overrides any existing value for an environment variable with this value. ### Signature ```go func (e Environment) ProcessOverridef(processType string, name string, format string, a ...interface{}) ``` ``` -------------------------------- ### Label Type Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Represents an image label with a key and value. ```APIDOC ## type Label ¶ added in v1.9.0 ### Description Label represents an image label. ### Fields - **Key** (string) - The key of the label. - **Value** (string) - The value of the label. ``` -------------------------------- ### ExecDWriter Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for types that write exec.d output to file descriptor 3. ```APIDOC ## type ExecDWriter ¶ added in v1.24.0 ### Description ExecDWriter is the interface implemented by a type that wants to write exec.d output to file descriptor 3. ### Interface Methods #### Write ##### Description Write is called with the map of environment value key value pairs that will be written out. ##### Signature ```go func (ExecDWriter) Write(value map[string]string) error ``` ``` -------------------------------- ### Define LayerContributor interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc Interface for types responsible for creating and transforming layers. ```go type LayerContributor interface { // Contribute accepts a layer and transforms it, returning a layer. Contribute(layer Layer) (Layer, error) // Name is the name of the layer. Name() string } ``` -------------------------------- ### LayerContributor Interface Source: https://pkg.go.dev/github.com/buildpacks/libcnb?tab=doc An interface for types that create layers, defining methods for contribution and naming. ```APIDOC ## type LayerContributor LayerContributor is an interface for types that create layers. ### Methods - **Contribute**(layer Layer) (Layer, error) - Accepts a layer and transforms it, returning a layer. - **Name**() string - Returns the name of the layer. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.