Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Autogenerated code
Browse files Browse the repository at this point in the history
  • Loading branch information
luxas committed Jul 3, 2019
1 parent e2ce893 commit 0b9cb5d
Show file tree
Hide file tree
Showing 6 changed files with 340 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pkg/apis/ignite/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions pkg/apis/meta/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions pkg/client/zz_generated.client_image.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

/*
Note: This file is autogenerated! Do not edit it manually!
Edit client_image_template.go instead, and run
hack/generate-client.sh afterwards.
*/

package client

import (
"github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1"
"github.com/weaveworks/ignite/pkg/storage"
)

// ImageClient is an interface for accessing Image-specific API objects
type ImageClient interface {
storage.Cache

// Get returns a Image object based on a reference string; which can either
// match the Image's Name or UID, or be a prefix of the UID
Get(ref string) (*v1alpha1.Image, error)
// Set saves a Image into the persistent storage
Set(image *v1alpha1.Image) error
// Delete deletes the API object from the storage
Delete(uid string) error
// List returns a list of all Images available
List() ([]*v1alpha1.Image, error)
}

// Images returns the ImageClient for the Client instance
func (c *Client) Images() ImageClient {
if c.imageClient == nil {
c.imageClient = newImageClient(c.storage)
}
return c.imageClient
}

// Images is a shorthand for accessing Images using the default client
func Images() ImageClient {
return DefaultClient.Images()
}

// imageClient is a struct implementing the ImageClient interface
// It uses a shared storage instance passed from the Client
type imageClient struct {
storage.Cache
storage storage.Storage
}

// newImageClient builds the imageClient struct using the storage implementation
// It automatically fetches all metadata for all API types of the specific kind into the cache
func newImageClient(s storage.Storage) ImageClient {
c, err := s.GetCache(v1alpha1.ImageKind)
if err != nil {
panic(err)
}
return &imageClient{storage: s, Cache: c}
}

// Get returns a Image object based on a reference string; which can either
// match the Image's Name or UID, or be a prefix of the UID
func (c *imageClient) Get(ref string) (*v1alpha1.Image, error) {
meta, err := c.MatchOne(ref)
if err != nil {
return nil, err
}
image := &v1alpha1.Image{ObjectMeta: meta.ObjectMeta}
if err := c.storage.Get(image); err != nil {
return nil, err
}
return image, nil
}

// Set saves a Image into the persistent storage
func (c *imageClient) Set(image *v1alpha1.Image) error {
return c.storage.Set(image)
}

// Delete deletes the API object from the storage
func (c *imageClient) Delete(uid string) error {
return c.storage.Delete(v1alpha1.ImageKind, uid)
}

// List returns a list of all Images available
func (c *imageClient) List() ([]*v1alpha1.Image, error) {
list, err := c.storage.List(v1alpha1.ImageKind)
if err != nil {
return nil, err
}
result := []*v1alpha1.Image{}
for _, item := range list {
result = append(result, item.(*v1alpha1.Image))
}
return result, nil
}
95 changes: 95 additions & 0 deletions pkg/client/zz_generated.client_kernel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

/*
Note: This file is autogenerated! Do not edit it manually!
Edit client_kernel_template.go instead, and run
hack/generate-client.sh afterwards.
*/

package client

import (
"github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1"
"github.com/weaveworks/ignite/pkg/storage"
)

// KernelClient is an interface for accessing Kernel-specific API objects
type KernelClient interface {
storage.Cache

// Get returns a Kernel object based on a reference string; which can either
// match the Kernel's Name or UID, or be a prefix of the UID
Get(ref string) (*v1alpha1.Kernel, error)
// Set saves a Kernel into the persistent storage
Set(kernel *v1alpha1.Kernel) error
// Delete deletes the API object from the storage
Delete(uid string) error
// List returns a list of all Kernels available
List() ([]*v1alpha1.Kernel, error)
}

// Kernels returns the KernelClient for the Client instance
func (c *Client) Kernels() KernelClient {
if c.kernelClient == nil {
c.kernelClient = newKernelClient(c.storage)
}
return c.kernelClient
}

// Kernels is a shorthand for accessing Kernels using the default client
func Kernels() KernelClient {
return DefaultClient.Kernels()
}

// kernelClient is a struct implementing the KernelClient interface
// It uses a shared storage instance passed from the Client
type kernelClient struct {
storage.Cache
storage storage.Storage
}

// newKernelClient builds the kernelClient struct using the storage implementation
// It automatically fetches all metadata for all API types of the specific kind into the cache
func newKernelClient(s storage.Storage) KernelClient {
c, err := s.GetCache(v1alpha1.KernelKind)
if err != nil {
panic(err)
}
return &kernelClient{storage: s, Cache: c}
}

// Get returns a Kernel object based on a reference string; which can either
// match the Kernel's Name or UID, or be a prefix of the UID
func (c *kernelClient) Get(ref string) (*v1alpha1.Kernel, error) {
meta, err := c.MatchOne(ref)
if err != nil {
return nil, err
}
kernel := &v1alpha1.Kernel{ObjectMeta: meta.ObjectMeta}
if err := c.storage.Get(kernel); err != nil {
return nil, err
}
return kernel, nil
}

// Set saves a Kernel into the persistent storage
func (c *kernelClient) Set(kernel *v1alpha1.Kernel) error {
return c.storage.Set(kernel)
}

// Delete deletes the API object from the storage
func (c *kernelClient) Delete(uid string) error {
return c.storage.Delete(v1alpha1.KernelKind, uid)
}

// List returns a list of all Kernels available
func (c *kernelClient) List() ([]*v1alpha1.Kernel, error) {
list, err := c.storage.List(v1alpha1.KernelKind)
if err != nil {
return nil, err
}
result := []*v1alpha1.Kernel{}
for _, item := range list {
result = append(result, item.(*v1alpha1.Kernel))
}
return result, nil
}
95 changes: 95 additions & 0 deletions pkg/client/zz_generated.client_vm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@

/*
Note: This file is autogenerated! Do not edit it manually!
Edit client_vm_template.go instead, and run
hack/generate-client.sh afterwards.
*/

package client

import (
"github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1"
"github.com/weaveworks/ignite/pkg/storage"
)

// VMClient is an interface for accessing VM-specific API objects
type VMClient interface {
storage.Cache

// Get returns a VM object based on a reference string; which can either
// match the VM's Name or UID, or be a prefix of the UID
Get(ref string) (*v1alpha1.VM, error)
// Set saves a VM into the persistent storage
Set(vm *v1alpha1.VM) error
// Delete deletes the API object from the storage
Delete(uid string) error
// List returns a list of all VMs available
List() ([]*v1alpha1.VM, error)
}

// VMs returns the VMClient for the Client instance
func (c *Client) VMs() VMClient {
if c.vmClient == nil {
c.vmClient = newVMClient(c.storage)
}
return c.vmClient
}

// VMs is a shorthand for accessing VMs using the default client
func VMs() VMClient {
return DefaultClient.VMs()
}

// vmClient is a struct implementing the VMClient interface
// It uses a shared storage instance passed from the Client
type vmClient struct {
storage.Cache
storage storage.Storage
}

// newVMClient builds the vmClient struct using the storage implementation
// It automatically fetches all metadata for all API types of the specific kind into the cache
func newVMClient(s storage.Storage) VMClient {
c, err := s.GetCache(v1alpha1.VMKind)
if err != nil {
panic(err)
}
return &vmClient{storage: s, Cache: c}
}

// Get returns a VM object based on a reference string; which can either
// match the VM's Name or UID, or be a prefix of the UID
func (c *vmClient) Get(ref string) (*v1alpha1.VM, error) {
meta, err := c.MatchOne(ref)
if err != nil {
return nil, err
}
vm := &v1alpha1.VM{ObjectMeta: meta.ObjectMeta}
if err := c.storage.Get(vm); err != nil {
return nil, err
}
return vm, nil
}

// Set saves a VM into the persistent storage
func (c *vmClient) Set(vm *v1alpha1.VM) error {
return c.storage.Set(vm)
}

// Delete deletes the API object from the storage
func (c *vmClient) Delete(uid string) error {
return c.storage.Delete(v1alpha1.VMKind, uid)
}

// List returns a list of all VMs available
func (c *vmClient) List() ([]*v1alpha1.VM, error) {
list, err := c.storage.List(v1alpha1.VMKind)
if err != nil {
return nil, err
}
result := []*v1alpha1.VM{}
for _, item := range list {
result = append(result, item.(*v1alpha1.VM))
}
return result, nil
}
Loading

0 comments on commit 0b9cb5d

Please sign in to comment.