Documentation ¶
Index ¶
- Constants
- func FindChildResourcesForResourceType(resourceType string) []string
- func FindGroupKindForResourceType(t string) (schema.GroupKind, bool)
- func FindResourceTypesByScope(scope genruntime.ResourceScope) []string
- func IsExtensionType(typeName string) bool
- func IsResourceGroupType(rsrcType string) bool
- type ImportError
- type ImportResourceResult
- type ImportableResource
- type ImportedResource
- type ResourceImporter
- type ResourceImporterOptions
- type Result
- func (r *Result) AddAnnotations(toAdd []string) error
- func (r *Result) AddLabels(toAdd []string) error
- func (r *Result) Count() int
- func (r *Result) SaveToIndividualFilesInFolder(folder string) error
- func (r *Result) SaveToSingleFile(filepath string) error
- func (r *Result) SaveToWriter(destination io.Writer) error
- func (r *Result) SetNamespace(namespace string)
- type SkippedError
Constants ¶
const ( Imported resourceImportReportStatus = "Imported" Skipped resourceImportReportStatus = "Skipped" Failed resourceImportReportStatus = "Failed" )
Variables ¶
This section is empty.
Functions ¶
func FindResourceTypesByScope ¶
func FindResourceTypesByScope(scope genruntime.ResourceScope) []string
FindResourceTypesByScope returns the resource types that may be parented in the given scope
func IsExtensionType ¶
IsExtensionType returns true if the given type name is an extension type
func IsResourceGroupType ¶
Types ¶
type ImportError ¶
type ImportError struct {
// contains filtered or unexported fields
}
func MakeImportError ¶
func MakeImportError(err error, gk schema.GroupKind, name string) ImportError
func (*ImportError) Error ¶
func (ie *ImportError) Error() string
func (*ImportError) Unwrap ¶
func (ie *ImportError) Unwrap() error
type ImportResourceResult ¶
type ImportResourceResult struct {
// contains filtered or unexported fields
}
type ImportableResource ¶
type ImportableResource interface { // GroupKind returns the GroupKind of the resource being imported. // (empty if the GK can't be determined) GroupKind() schema.GroupKind // Name is a human-readable identifier for this resource Name() string // ID is a unique identifier for this resource. // The ID of a resource must unique within the import operation; the easiest way to achieve this is // to make it globally unique. ID() string // Import does the actual import, updating the Spec on the wrapped resource. // ctx allows for cancellation of the import. // log allows information about progress to be reported Import( ctx context.Context, reporter importreporter.Interface, factory *importFactory, log logr.Logger, ) (ImportResourceResult, error) }
ImportableResource is an interface that wraps a Kubernetes resource that can be imported. Different implementations of this interface will be used for different types of resources.
func NewImportableARMResource ¶
func NewImportableARMResource( id string, owner *genruntime.ResourceReference, client *genericarmclient.GenericClient, ) (ImportableResource, error)
NewImportableARMResource creates a new importable ARM resource id is the ARM ID of the resource to import. owner is the resource that owns this resource (if any). client is the client to use to talk to ARM.
type ImportedResource ¶
type ImportedResource interface { // GroupKind returns the GroupKind of the resource that was imported GroupKind() schema.GroupKind // Name is a human-readable identifier for this resource Name() string // ID is a unique identifier for this resource. // The ID of a resource must unique within the import operation; the easiest way to achieve this is // to make it globally unique. ID() string // Resource returns the actual resource that has been imported. Resource() genruntime.MetaObject }
ImportedResource is an interface that wraps a Kubernetes resource that has been imported.
type ResourceImporter ¶
type ResourceImporter struct {
// contains filtered or unexported fields
}
ResourceImporter is the entry point for importing resources. Factory methods here provide ways to instantiate importers for different kinds of resources.
func New ¶
func New( scheme *runtime.Scheme, client *genericarmclient.GenericClient, log logr.Logger, reporter importreporter.Interface, options ResourceImporterOptions, ) *ResourceImporter
New creates a new factory with the scheme baked in
func (*ResourceImporter) Add ¶
func (ri *ResourceImporter) Add(importer ImportableResource)
Add adds an importer to the list of resources to import.
func (*ResourceImporter) AddARMID ¶
func (ri *ResourceImporter) AddARMID(armID string) error
AddARMID adds an ARM ID to the list of resources to import.
type ResourceImporterOptions ¶
type ResourceImporterOptions struct { // Workers is the number of concurrent imports to run at the same time. If not specified, a default of 4 is used. Workers int }
ResourceImporterOptions are optional configuration items for the importer
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result represents the result of an import operation
func (*Result) AddAnnotations ¶
AddAnnotations adds the given annotations to all the resources
func (*Result) SaveToIndividualFilesInFolder ¶
func (*Result) SaveToSingleFile ¶
func (*Result) SetNamespace ¶
SetNamespace sets the namespace for all the resources
type SkippedError ¶
type SkippedError struct { GroupKind schema.GroupKind Name string Because string Resource ImportableResource }
SkippedError is an error that indicates that a resource cannot be imported for a reason we know about. This allows us to continue the import even if some expected errors occur.
func NewSkippedError ¶
func NewSkippedError( groupKind schema.GroupKind, name string, because string, resource ImportableResource, ) *SkippedError
func (SkippedError) Error ¶
func (e SkippedError) Error() string