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 ImportResourceResult
- type ImportSkippedError
- type ImportableResource
- type ResourceImportResult
- type ResourceImporter
- func (ri *ResourceImporter) Add(importer ImportableResource)
- func (ri *ResourceImporter) AddARMID(armID string) error
- func (ri *ResourceImporter) Import(ctx context.Context) (*ResourceImportResult, error)
- func (ri *ResourceImporter) ImportResource(ctx context.Context, rsrc ImportableResource, parent chan<- progressDelta) ImportResourceResult
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 ImportResourceResult ¶
type ImportResourceResult struct {
// contains filtered or unexported fields
}
type ImportSkippedError ¶
type ImportSkippedError struct { GroupKind schema.GroupKind Name string Because string Resource ImportableResource }
ImportSkippedError 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 NewImportSkippedError ¶
func NewImportSkippedError( groupKind schema.GroupKind, name string, because string, resource ImportableResource, ) *ImportSkippedError
func (ImportSkippedError) Error ¶
func (e ImportSkippedError) Error() string
type ImportableResource ¶
type ImportableResource interface { // GroupKind returns the GroupKind of the resource being imported. // (may be 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 unique within the import operation; the easiest way to achive this is // to make it globally unique. Id() string // Resource returns the actual resource that has been imported. // Only available after the import is complete (nil otherwise). Resource() genruntime.MetaObject // Import does the actual import, updating the Spec on the wrapped resource. // ctx allows for cancellation of the import. // progress is a channel that can be used to report progress back to the caller. Import( ctx context.Context, log logr.Logger, ) error // FindChildren returns any child resources that need to be imported. // ctx allows for cancellation of the import. // Returns any additional resources that also need to be imported, as well as any errors that occur. // Partial success is allowed, but the caller should be notified of any errors. FindChildren( ctx context.Context, progress chan<- progressDelta, ) ([]ImportableResource, 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, scheme *runtime.Scheme, ) (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. scheme is the scheme to use to create the resource.
type ResourceImportResult ¶
type ResourceImportResult struct {
// contains filtered or unexported fields
}
ResourceImportResult represents the result of an import operation
func (*ResourceImportResult) Count ¶
func (r *ResourceImportResult) Count() int
Count returns the number of successfully imported resources.
func (*ResourceImportResult) SaveToIndividualFilesInFolder ¶
func (r *ResourceImportResult) SaveToIndividualFilesInFolder(folder string) error
func (*ResourceImportResult) SaveToSingleFile ¶
func (r *ResourceImportResult) SaveToSingleFile(filepath string) error
func (*ResourceImportResult) SaveToWriter ¶
func (r *ResourceImportResult) SaveToWriter(destination io.Writer) error
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 NewResourceImporter ¶
func NewResourceImporter( scheme *runtime.Scheme, client *genericarmclient.GenericClient, log logr.Logger, progress *mpb.Progress) *ResourceImporter
NewResourceImporter 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.
func (*ResourceImporter) Import ¶
func (ri *ResourceImporter) Import( ctx context.Context, ) (*ResourceImportResult, error)
Import imports all the resources that have been added to the importer. Partial results are returned even in the case of an error.
func (*ResourceImporter) ImportResource ¶
func (ri *ResourceImporter) ImportResource( ctx context.Context, rsrc ImportableResource, parent chan<- progressDelta, ) ImportResourceResult