Documentation ¶
Overview ¶
Copyright 2021 IBM Corporation
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 IBM Corporation ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 IBM Corporation ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2021 IBM Corporation ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func CacheOptions(ttl time.Duration, cleanupPeriod time.Duration) func(*PullManager) error
- func GetString(c Config, key string) (string, bool)
- func HashStrings(strings ...string) string
- func OpenFile(path string) (*os.File, error)
- func RegisterProvider(providerType string, provider StorageProvider)
- type Config
- type PullCommand
- type PullManager
- type RepositoryClient
- type RepositoryConfig
- func (rc *RepositoryConfig) Get(key string) (interface{}, bool)
- func (rc *RepositoryConfig) GetString(key string) (string, bool)
- func (rc *RepositoryConfig) GetType() string
- func (rc *RepositoryConfig) MarshalJSON() ([]byte, error)
- func (rc *RepositoryConfig) Set(key string, val interface{})
- func (rc *RepositoryConfig) UnmarshalJSON(bs []byte) error
- type StorageProvider
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheOptions ¶
func HashStrings ¶
HashStrings generates a hash from the concatenation of the passed strings Provides a common way for providers to implement GetKey in the case that some configuration's values are considered secret. Use the hash as part of the key instead
func RegisterProvider ¶
func RegisterProvider(providerType string, provider StorageProvider)
RegisterProvider should only be called when initializing the application
Types ¶
type Config ¶
type Config interface { // GetType returns the type of the config GetType() string // Get returns a key's value and a bool if it was specified Get(name string) (interface{}, bool) }
Config represents simple key/value configuration with a type/class
type PullCommand ¶
type PullCommand struct { // repository from which files will be pulled RepositoryConfig Config // local directory where files will be pulled to Directory string // the list of paths referring to resources to be pulled Targets []Target }
Represents the command sent to PullMan to be fulfilled
type PullManager ¶
type PullManager struct {
// contains filtered or unexported fields
}
func NewPullManager ¶
func NewPullManager(log logr.Logger, options ...func(*PullManager)) *PullManager
func (*PullManager) Pull ¶
func (p *PullManager) Pull(ctx context.Context, pc PullCommand) error
Pull processes the PullCommand, pulling files to the local filesystem
type RepositoryClient ¶
type RepositoryClient interface {
Pull(context.Context, PullCommand) error
}
A RepositoryClient is the worker that executes a PullCommand
type RepositoryConfig ¶
type RepositoryConfig struct {
// contains filtered or unexported fields
}
Generic config abstraction used by PullMan
func NewRepositoryConfig ¶
func NewRepositoryConfig(storageType string, config map[string]interface{}) *RepositoryConfig
func (*RepositoryConfig) Get ¶
func (rc *RepositoryConfig) Get(key string) (interface{}, bool)
func (*RepositoryConfig) GetString ¶
func (rc *RepositoryConfig) GetString(key string) (string, bool)
func (*RepositoryConfig) GetType ¶
func (rc *RepositoryConfig) GetType() string
func (*RepositoryConfig) MarshalJSON ¶
func (rc *RepositoryConfig) MarshalJSON() ([]byte, error)
func (*RepositoryConfig) Set ¶
func (rc *RepositoryConfig) Set(key string, val interface{})
func (*RepositoryConfig) UnmarshalJSON ¶
func (rc *RepositoryConfig) UnmarshalJSON(bs []byte) error
type StorageProvider ¶
type StorageProvider interface { NewRepository(config Config, log logr.Logger) (RepositoryClient, error) // GetKey generates a string from the config that only includes fields // required to build the connection to the storage service. If the key // of two configs match, a single RepositoryClient must be able to // handle pulls with both configs. // Note: GetKey should not validate the config GetKey(config Config) string }
A StorageProvider is a factory for RepositoryClients