1
0
mirror of https://github.com/rancher/types.git synced 2025-07-02 16:31:48 +00:00

Update generated code

This commit is contained in:
Darren Shepherd 2017-12-23 22:23:50 -07:00
parent 52161ec23b
commit c833e41eb4
11 changed files with 212 additions and 9 deletions

View File

@ -7,6 +7,8 @@ import (
type Client struct {
clientbase.APIBaseClient
Namespace NamespaceOperations
Ingress IngressOperations
Secret SecretOperations
ServiceAccountToken ServiceAccountTokenOperations
DockerCredential DockerCredentialOperations
@ -15,7 +17,6 @@ type Client struct {
SSHAuth SSHAuthOperations
Service ServiceOperations
Endpoint EndpointOperations
Namespace NamespaceOperations
Pod PodOperations
Deployment DeploymentOperations
PersistentVolumeClaim PersistentVolumeClaimOperations
@ -36,6 +37,8 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
APIBaseClient: baseClient,
}
client.Namespace = newNamespaceClient(client)
client.Ingress = newIngressClient(client)
client.Secret = newSecretClient(client)
client.ServiceAccountToken = newServiceAccountTokenClient(client)
client.DockerCredential = newDockerCredentialClient(client)
@ -44,7 +47,6 @@ func NewClient(opts *clientbase.ClientOpts) (*Client, error) {
client.SSHAuth = newSSHAuthClient(client)
client.Service = newServiceClient(client)
client.Endpoint = newEndpointClient(client)
client.Namespace = newNamespaceClient(client)
client.Pod = newPodClient(client)
client.Deployment = newDeploymentClient(client)
client.PersistentVolumeClaim = newPersistentVolumeClaimClient(client)

View File

@ -13,6 +13,7 @@ const (
EndpointFieldName = "name"
EndpointFieldNamespaceId = "namespaceId"
EndpointFieldOwnerReferences = "ownerReferences"
EndpointFieldPodIDs = "podIds"
EndpointFieldProjectID = "projectId"
EndpointFieldRemoved = "removed"
EndpointFieldTargets = "targets"
@ -28,6 +29,7 @@ type Endpoint struct {
Name string `json:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
PodIDs []string `json:"podIds,omitempty"`
ProjectID string `json:"projectId,omitempty"`
Removed string `json:"removed,omitempty"`
Targets []Target `json:"targets,omitempty"`

View File

@ -0,0 +1,16 @@
package client
const (
HTTPIngressPathType = "httpIngressPath"
HTTPIngressPathFieldPath = "path"
HTTPIngressPathFieldServiceId = "serviceId"
HTTPIngressPathFieldServicePort = "servicePort"
HTTPIngressPathFieldWorkloadIDs = "workloadIds"
)
type HTTPIngressPath struct {
Path string `json:"path,omitempty"`
ServiceId string `json:"serviceId,omitempty"`
ServicePort string `json:"servicePort,omitempty"`
WorkloadIDs []string `json:"workloadIds,omitempty"`
}

View File

@ -0,0 +1,10 @@
package client
const (
HTTPIngressRuleValueType = "httpIngressRuleValue"
HTTPIngressRuleValueFieldPaths = "paths"
)
type HTTPIngressRuleValue struct {
Paths []HTTPIngressPath `json:"paths,omitempty"`
}

View File

@ -0,0 +1,109 @@
package client
import (
"github.com/rancher/norman/types"
)
const (
IngressType = "ingress"
IngressFieldAnnotations = "annotations"
IngressFieldCreated = "created"
IngressFieldDefaultBackend = "defaultBackend"
IngressFieldFinalizers = "finalizers"
IngressFieldLabels = "labels"
IngressFieldName = "name"
IngressFieldNamespaceId = "namespaceId"
IngressFieldOwnerReferences = "ownerReferences"
IngressFieldProjectID = "projectId"
IngressFieldRemoved = "removed"
IngressFieldRules = "rules"
IngressFieldState = "state"
IngressFieldStatus = "status"
IngressFieldTLS = "tls"
IngressFieldTransitioning = "transitioning"
IngressFieldTransitioningMessage = "transitioningMessage"
IngressFieldUuid = "uuid"
)
type Ingress struct {
types.Resource
Annotations map[string]string `json:"annotations,omitempty"`
Created string `json:"created,omitempty"`
DefaultBackend *IngressBackend `json:"defaultBackend,omitempty"`
Finalizers []string `json:"finalizers,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Name string `json:"name,omitempty"`
NamespaceId string `json:"namespaceId,omitempty"`
OwnerReferences []OwnerReference `json:"ownerReferences,omitempty"`
ProjectID string `json:"projectId,omitempty"`
Removed string `json:"removed,omitempty"`
Rules []IngressRule `json:"rules,omitempty"`
State string `json:"state,omitempty"`
Status *IngressStatus `json:"status,omitempty"`
TLS []IngressTLS `json:"tls,omitempty"`
Transitioning string `json:"transitioning,omitempty"`
TransitioningMessage string `json:"transitioningMessage,omitempty"`
Uuid string `json:"uuid,omitempty"`
}
type IngressCollection struct {
types.Collection
Data []Ingress `json:"data,omitempty"`
client *IngressClient
}
type IngressClient struct {
apiClient *Client
}
type IngressOperations interface {
List(opts *types.ListOpts) (*IngressCollection, error)
Create(opts *Ingress) (*Ingress, error)
Update(existing *Ingress, updates interface{}) (*Ingress, error)
ByID(id string) (*Ingress, error)
Delete(container *Ingress) error
}
func newIngressClient(apiClient *Client) *IngressClient {
return &IngressClient{
apiClient: apiClient,
}
}
func (c *IngressClient) Create(container *Ingress) (*Ingress, error) {
resp := &Ingress{}
err := c.apiClient.Ops.DoCreate(IngressType, container, resp)
return resp, err
}
func (c *IngressClient) Update(existing *Ingress, updates interface{}) (*Ingress, error) {
resp := &Ingress{}
err := c.apiClient.Ops.DoUpdate(IngressType, &existing.Resource, updates, resp)
return resp, err
}
func (c *IngressClient) List(opts *types.ListOpts) (*IngressCollection, error) {
resp := &IngressCollection{}
err := c.apiClient.Ops.DoList(IngressType, opts, resp)
resp.client = c
return resp, err
}
func (cc *IngressCollection) Next() (*IngressCollection, error) {
if cc != nil && cc.Pagination != nil && cc.Pagination.Next != "" {
resp := &IngressCollection{}
err := cc.client.apiClient.Ops.DoNext(cc.Pagination.Next, resp)
resp.client = cc.client
return resp, err
}
return nil, nil
}
func (c *IngressClient) ByID(id string) (*Ingress, error) {
resp := &Ingress{}
err := c.apiClient.Ops.DoByID(IngressType, id, resp)
return resp, err
}
func (c *IngressClient) Delete(container *Ingress) error {
return c.apiClient.Ops.DoResourceDelete(IngressType, &container.Resource)
}

View File

@ -0,0 +1,14 @@
package client
const (
IngressBackendType = "ingressBackend"
IngressBackendFieldServiceId = "serviceId"
IngressBackendFieldServicePort = "servicePort"
IngressBackendFieldWorkloadIDs = "workloadIds"
)
type IngressBackend struct {
ServiceId string `json:"serviceId,omitempty"`
ServicePort string `json:"servicePort,omitempty"`
WorkloadIDs []string `json:"workloadIds,omitempty"`
}

View File

@ -0,0 +1,12 @@
package client
const (
IngressRuleType = "ingressRule"
IngressRuleFieldHTTP = "http"
IngressRuleFieldHost = "host"
)
type IngressRule struct {
HTTP *HTTPIngressRuleValue `json:"http,omitempty"`
Host string `json:"host,omitempty"`
}

View File

@ -0,0 +1,14 @@
package client
const (
IngressSpecType = "ingressSpec"
IngressSpecFieldBackend = "backend"
IngressSpecFieldRules = "rules"
IngressSpecFieldTLS = "tls"
)
type IngressSpec struct {
Backend *IngressBackend `json:"backend,omitempty"`
Rules []IngressRule `json:"rules,omitempty"`
TLS []IngressTLS `json:"tls,omitempty"`
}

View File

@ -0,0 +1,10 @@
package client
const (
IngressStatusType = "ingressStatus"
IngressStatusFieldLoadBalancer = "loadBalancer"
)
type IngressStatus struct {
LoadBalancer *LoadBalancerStatus `json:"loadBalancer,omitempty"`
}

View File

@ -0,0 +1,12 @@
package client
const (
IngressTLSType = "ingressTLS"
IngressTLSFieldCertificateId = "certificateId"
IngressTLSFieldHosts = "hosts"
)
type IngressTLS struct {
CertificateId string `json:"certificateId,omitempty"`
Hosts []string `json:"hosts,omitempty"`
}

View File

@ -1,14 +1,16 @@
package client
const (
TargetType = "target"
TargetFieldAddresses = "addresses"
TargetFieldPort = "port"
TargetFieldProtocol = "protocol"
TargetType = "target"
TargetFieldAddresses = "addresses"
TargetFieldNotReadyAddresses = "notReadyAddresses"
TargetFieldPort = "port"
TargetFieldProtocol = "protocol"
)
type Target struct {
Addresses []string `json:"addresses,omitempty"`
Port *int64 `json:"port,omitempty"`
Protocol string `json:"protocol,omitempty"`
Addresses []string `json:"addresses,omitempty"`
NotReadyAddresses []string `json:"notReadyAddresses,omitempty"`
Port *int64 `json:"port,omitempty"`
Protocol string `json:"protocol,omitempty"`
}