Documentation
¶
Overview ¶
Package ocp provides functionality for interacting with the OCP API.
Index ¶
- type AmazonS3
- type AzureBlobStorage
- type BundleConfig
- type Client
- func (c *Client) DeleteBundle(ctx context.Context, name string) (err error)
- func (c *Client) DeleteSource(ctx context.Context, id string) (err error)
- func (c *Client) GetSource(ctx context.Context, path string) (resp *GetSourceResponse, err error)
- func (c *Client) InvalidateCache()
- func (c *Client) PutBundle(ctx context.Context, bundle *PutBundleRequest) (err error)
- func (c *Client) PutSource(ctx context.Context, id string, request *PutSourceRequest) (resp *PutSourceResponse, err error)
- type ClientInterface
- type Datasource
- type FileSystemStorage
- type GCPCloudStorage
- type GetSourceResponse
- type GitConfig
- type GitRequirement
- type OPAConfig
- type ObjectStorage
- type PutBundleRequest
- type PutBundleResponse
- type PutSourceRequest
- type PutSourceResponse
- type Requirement
- type Secret
- type SecretRef
- type SourceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmazonS3 ¶
type AmazonS3 struct {
Bucket string `json:"bucket" yaml:"bucket"`
Key string `json:"key" yaml:"key"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
Credentials string `json:"credentials,omitempty" yaml:"credentials,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
AmazonS3 defines the configuration for a bundle stored in an Amazon S3 bucket.
type AzureBlobStorage ¶
type AzureBlobStorage struct {
AccountURL string `json:"account_url" yaml:"account_url"`
Container string `json:"container" yaml:"container"`
Path string `json:"path" yaml:"path"`
Credentials string `json:"credentials,omitempty" yaml:"credentials,omitempty"`
}
AzureBlobStorage defines the configuration for an Azure Blob Storage container.
type BundleConfig ¶
type BundleConfig struct {
Name string `json:"-" yaml:"-"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
ObjectStorage ObjectStorage `json:"object_storage,omitempty" yaml:"object_storage,omitempty"`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
ExcludedFiles []string `json:"excluded_files,omitempty" yaml:"excluded_files,omitempty"`
}
BundleConfig represents the configuration of a bundle in the OCP APIs.
type Client ¶
type Client struct {
HTTPClient http.Client
URL string
Cache *cache.Cache
// contains filtered or unexported fields
}
Client is a client for the OCP APIs.
func (*Client) DeleteBundle ¶ added in v0.30.0
DeleteBundle calls the DELETE /v1/bundles/{name} endpoint in the OCP API.
func (*Client) DeleteSource ¶ added in v0.30.0
DeleteSource calls the DELETE /v1/sources/{name} endpoint in the OCP API.
func (*Client) InvalidateCache ¶
func (c *Client) InvalidateCache()
InvalidateCache invalidates the entire cache
func (*Client) PutBundle ¶
func (c *Client) PutBundle(ctx context.Context, bundle *PutBundleRequest) (err error)
PutBundle calls the PUT /v1/bundles/{name} endpoint in the OCP API.
func (*Client) PutSource ¶
func (c *Client) PutSource( ctx context.Context, id string, request *PutSourceRequest, ) (resp *PutSourceResponse, err error)
PutSource calls the PUT /v1/sources/{id} endpoint in the OCP API.
type ClientInterface ¶
type ClientInterface interface {
GetSource(ctx context.Context, id string) (*GetSourceResponse, error)
PutSource(ctx context.Context, id string, request *PutSourceRequest) (*PutSourceResponse, error)
DeleteSource(ctx context.Context, id string) error
PutBundle(ctx context.Context, bundle *PutBundleRequest) error
DeleteBundle(ctx context.Context, name string) error
}
ClientInterface defines the interface for the OCP client.
func New ¶
func New(url string, token string) ClientInterface
New creates a new OCP ClientInterface.
type Datasource ¶
type Datasource struct {
Name string `json:"name" yaml:"name"`
Path string `json:"path" yaml:"path"`
Type string `json:"type" yaml:"type"`
TransformQuery string `json:"transform_query,omitempty" yaml:"transform_query,omitempty"`
Config map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
Credentials *SecretRef `json:"credentials,omitempty" yaml:"credentials,omitempty"`
}
Datasource represents a datasource for a source.
type FileSystemStorage ¶
type FileSystemStorage struct {
Path string `json:"path" yaml:"path"` // Path to the bundle on the local filesystem.
}
FileSystemStorage defines the configuration for a local filesystem storage.
type GCPCloudStorage ¶
type GCPCloudStorage struct {
Project string `json:"project" yaml:"project"`
Bucket string `json:"bucket" yaml:"bucket"`
Object string `json:"object" yaml:"object"`
Credentials string `json:"credentials,omitempty" yaml:"credentials,omitempty"`
}
GCPCloudStorage defines the configuration for a Google Cloud Storage bucket.
type GetSourceResponse ¶
type GetSourceResponse struct {
StatusCode int
Body []byte
Source *SourceConfig
Message string
}
GetSourceResponse is the response type for calls to the GET /v1/sources/{id} endpoint in the OCP API.
type GitConfig ¶
type GitConfig struct {
Repo string `json:"repo"`
Reference string `json:"reference"`
Commit string `json:"commit,omitempty"`
Path string `json:"path"`
IncludedFiles []string `json:"included_files,omitempty"`
ExcludedFiles []string `json:"excluded_files,omitempty"`
CredentialID string `json:"credentials,omitempty"`
}
GitConfig represents the git source control configuration for a source.
type GitRequirement ¶
type GitRequirement struct {
Commit *string `json:"commit,omitempty" yaml:"commit,omitempty"`
}
GitRequirement represents Git requirement.
type OPAConfig ¶
type OPAConfig struct {
BundleResource string
BundleService string
ServiceURL string
ServiceName string
UniqueName string
Namespace string
}
OPAConfig stores the information going into the ConfigMap for the OPA
type ObjectStorage ¶
type ObjectStorage struct {
AmazonS3 *AmazonS3 `json:"aws,omitempty" yaml:"aws,omitempty"`
}
ObjectStorage represents the object storage configuration for a bundle.
type PutBundleRequest ¶
type PutBundleRequest struct {
Name string `json:"-" yaml:"-"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
ObjectStorage ObjectStorage `json:"object_storage,omitempty" yaml:"object_storage,omitempty"`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
ExcludedFiles []string `json:"excluded_files,omitempty" yaml:"excluded_files,omitempty"`
}
PutBundleRequest is the request body for the PUT /v1/bundles/{name} endpoint in the OCP API.
type PutBundleResponse ¶
type PutBundleResponse struct {
StatusCode string `json:"status_code"`
Code string `json:"code"`
Message string `json:"message"`
}
PutBundleResponse is the response type for calls to the PUT /v1/bundles/{name} endpoint in the OCP API.
type PutSourceRequest ¶
type PutSourceRequest struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Builtin *string `json:"builtin,omitempty" yaml:"builtin,omitempty"`
Git *GitConfig `json:"git,omitempty" yaml:"git,omitempty"`
Datasources []Datasource `json:"datasources,omitempty" yaml:"datasources,omitempty"`
EmbeddedFiles map[string]string `json:"files,omitempty" yaml:"files,omitempty"`
// Root directory for the source files, used to resolve file paths below.
Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
}
PutSourceRequest is the request body for the PUT /v1/sources/{id} endpoint in the OCP API.
type PutSourceResponse ¶
PutSourceResponse is the response type for calls to the PUT /v1/sources/{id} endpoint in the OCP API.
type Requirement ¶
type Requirement struct {
Source string `json:"source,omitempty" yaml:"source,omitempty"`
Git GitRequirement `json:"git,omitempty" yaml:"git,omitempty"`
}
Requirement represents a requirement for a bundle and a source.
func NewRequirement ¶
func NewRequirement(source string) Requirement
NewRequirement creates a new Requirement for a bundle.
func ToRequirements ¶
func ToRequirements(sources []string) []Requirement
ToRequirements converts a list of sources to a list of Requirements.
type Secret ¶
type Secret struct {
Name string `json:"-" yaml:"-"`
Value map[string]interface{} `json:"-" yaml:"-"`
}
Secret represents a secret for a datasource in a source.
type SecretRef ¶
type SecretRef struct {
Name string `json:"-" yaml:"-"`
}
SecretRef represents a reference to a secret for a datasource in a source.
type SourceConfig ¶
type SourceConfig struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Builtin *string `json:"builtin,omitempty" yaml:"builtin,omitempty"`
Git GitConfig `json:"git,omitempty" yaml:"git,omitempty"`
Datasources []Datasource `json:"datasources,omitempty" yaml:"datasources,omitempty"`
EmbeddedFiles map[string]string `json:"files,omitempty" yaml:"files,omitempty"`
// Root directory for the source files, used to resolve file paths below.
Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
Requirements []Requirement `json:"requirements,omitempty" yaml:"requirements,omitempty"`
}
SourceConfig represents the configuration of a source in the OCP APIs.