meta

package
v0.0.0-...-db5eef7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package meta contains the meta description of the GCE cloud types to generate code for.

Index

Constants

View Source
const (
	// Zonal key type.
	Zonal = "zonal"
	// Regional key type.
	Regional = "regional"
	// Global key type.
	Global = "global"
)
View Source
const (
	// NoGet prevents the Get() method from being generated.
	NoGet = 1 << iota
	// NoList prevents the List() method from being generated.
	NoList = 1 << iota
	// NoDelete prevents the Delete() method from being generated.
	NoDelete = 1 << iota
	// NoInsert prevents the Insert() method from being generated.
	NoInsert = 1 << iota
	// CustomOps specifies that an empty interface xxxOps will be generated to
	// enable custom method calls to be attached to the generated service
	// interface.
	CustomOps = 1 << iota
	// AggregatedList will generated a method for AggregatedList().
	AggregatedList = 1 << iota

	// ReadOnly specifies that the given resource is read-only and should not
	// have insert() or delete() methods generated for the wrapper.
	ReadOnly = NoDelete | NoInsert

	// VersionGA is the API version in compute.v1.
	VersionGA Version = "ga"
	// VersionAlpha is the API version in computer.v0.alpha.
	VersionAlpha Version = "alpha"
	// VersionBeta is the API version in computer.v0.beta.
	VersionBeta Version = "beta"
)

Variables

View Source
var AllServices = []*ServiceInfo{
	{
		Object:   "Address",
		Service:  "Addresses",
		Resource: "addresses",
		// contains filtered or unexported fields
	},
	{
		Object:   "Address",
		Service:  "Addresses",
		Resource: "addresses",
		// contains filtered or unexported fields
	},
	{
		Object:   "Address",
		Service:  "Addresses",
		Resource: "addresses",
		// contains filtered or unexported fields
	},
	{
		Object:   "Address",
		Service:  "GlobalAddresses",
		Resource: "addresses",
		// contains filtered or unexported fields
	},
	{
		Object:   "BackendService",
		Service:  "BackendServices",
		Resource: "backendServices",
		// contains filtered or unexported fields
	},
	{
		Object:   "BackendService",
		Service:  "BackendServices",
		Resource: "backendServices",
		// contains filtered or unexported fields
	},
	{
		Object:   "BackendService",
		Service:  "BackendServices",
		Resource: "backendServices",
		// contains filtered or unexported fields
	},
	{
		Object:   "BackendService",
		Service:  "RegionBackendServices",
		Resource: "backendServices",
		// contains filtered or unexported fields
	},
	{
		Object:   "BackendService",
		Service:  "RegionBackendServices",
		Resource: "backendServices",
		// contains filtered or unexported fields
	},
	{
		Object:   "Disk",
		Service:  "Disks",
		Resource: "disks",
		// contains filtered or unexported fields
	},
	{
		Object:   "Disk",
		Service:  "RegionDisks",
		Resource: "disks",
		// contains filtered or unexported fields
	},
	{
		Object:   "Firewall",
		Service:  "Firewalls",
		Resource: "firewalls",
		// contains filtered or unexported fields
	},
	{
		Object:   "ForwardingRule",
		Service:  "ForwardingRules",
		Resource: "forwardingRules",
		// contains filtered or unexported fields
	},
	{
		Object:   "ForwardingRule",
		Service:  "ForwardingRules",
		Resource: "forwardingRules",
		// contains filtered or unexported fields
	},
	{
		Object:   "ForwardingRule",
		Service:  "GlobalForwardingRules",
		Resource: "forwardingRules",
		// contains filtered or unexported fields
	},
	{
		Object:   "HealthCheck",
		Service:  "HealthChecks",
		Resource: "healthChecks",
		// contains filtered or unexported fields
	},
	{
		Object:   "HealthCheck",
		Service:  "HealthChecks",
		Resource: "healthChecks",
		// contains filtered or unexported fields
	},
	{
		Object:   "HttpHealthCheck",
		Service:  "HttpHealthChecks",
		Resource: "httpHealthChecks",
		// contains filtered or unexported fields
	},
	{
		Object:   "HttpsHealthCheck",
		Service:  "HttpsHealthChecks",
		Resource: "httpsHealthChecks",
		// contains filtered or unexported fields
	},
	{
		Object:   "InstanceGroup",
		Service:  "InstanceGroups",
		Resource: "instanceGroups",
		// contains filtered or unexported fields
	},
	{
		Object:   "Instance",
		Service:  "Instances",
		Resource: "instances",
		// contains filtered or unexported fields
	},
	{
		Object:   "Instance",
		Service:  "Instances",
		Resource: "instances",
		// contains filtered or unexported fields
	},
	{
		Object:   "Instance",
		Service:  "Instances",
		Resource: "instances",
		// contains filtered or unexported fields
	},
	{
		Object:   "NetworkEndpointGroup",
		Service:  "NetworkEndpointGroups",
		Resource: "networkEndpointGroups",
		// contains filtered or unexported fields
	},
	{
		Object:   "Project",
		Service:  "Projects",
		Resource: "projects",
		// contains filtered or unexported fields
	},
	{
		Object:   "Region",
		Service:  "Regions",
		Resource: "regions",
		// contains filtered or unexported fields
	},
	{
		Object:   "Route",
		Service:  "Routes",
		Resource: "routes",
		// contains filtered or unexported fields
	},
	{
		Object:   "SecurityPolicy",
		Service:  "SecurityPolicies",
		Resource: "securityPolicies",
		// contains filtered or unexported fields
	},
	{
		Object:   "SslCertificate",
		Service:  "SslCertificates",
		Resource: "sslCertificates",
		// contains filtered or unexported fields
	},
	{
		Object:   "TargetHttpProxy",
		Service:  "TargetHttpProxies",
		Resource: "targetHttpProxies",
		// contains filtered or unexported fields
	},
	{
		Object:   "TargetHttpsProxy",
		Service:  "TargetHttpsProxies",
		Resource: "targetHttpsProxies",
		// contains filtered or unexported fields
	},
	{
		Object:   "TargetPool",
		Service:  "TargetPools",
		Resource: "targetPools",
		// contains filtered or unexported fields
	},
	{
		Object:   "UrlMap",
		Service:  "UrlMaps",
		Resource: "urlMaps",
		// contains filtered or unexported fields
	},
	{
		Object:   "Zone",
		Service:  "Zones",
		Resource: "zones",
		// contains filtered or unexported fields
	},
}

AllServices are a list of all the services to generate code for. Keep this list in lexiographical order by object type.

View Source
var AllServicesByGroup map[string]*ServiceGroup

AllServicesByGroup is a map of service name to ServicesGroup.

AllVersions is a list of all versions of the GCE API.

View Source
var SortedServicesGroups []*ServiceGroup

SortedServicesGroups is a slice of Servicegroup sorted by Service name.

Functions

func KeysToMap

func KeysToMap(keys ...Key) map[Key]bool

KeysToMap creates a map[Key]bool from a list of keys.

Types

type Key

type Key struct {
	Name   string
	Zone   string
	Region string
}

Key for a GCP resource.

func GlobalKey

func GlobalKey(name string) *Key

GlobalKey returns the key for a global resource.

func RegionalKey

func RegionalKey(name, region string) *Key

RegionalKey returns the key for a regional resource.

func ZonalKey

func ZonalKey(name, zone string) *Key

ZonalKey returns the key for a zonal resource.

func (Key) String

func (k Key) String() string

String returns a string representation of the key.

func (*Key) Type

func (k *Key) Type() KeyType

Type returns the type of the key.

func (*Key) Valid

func (k *Key) Valid() bool

Valid is true if the key is valid.

type KeyType

type KeyType string

KeyType is the type of the key.

type Method

type Method struct {
	*ServiceInfo

	// ReturnType is the return type for the method.
	ReturnType string
	// ItemType is the type of the individual elements returns from a
	// Pages() call. This is only applicable for MethodPaged kind.
	ItemType string
	// contains filtered or unexported fields
}

Method is used to generate the calling code for non-standard methods.

func (*Method) CallArgs

func (m *Method) CallArgs() string

CallArgs is a list of comma separated "argN" used for calling the method. For example, if the method has two additional arguments, this will return "arg0, arg1".

func (*Method) FcnArgs

func (m *Method) FcnArgs() string

FcnArgs is the function signature for the definition of the method.

func (*Method) InterfaceFunc

func (m *Method) InterfaceFunc() string

InterfaceFunc is the function declaration of the method in the interface.

func (*Method) IsGet

func (m *Method) IsGet() bool

IsGet is true if the method simple get.

func (*Method) IsOperation

func (m *Method) IsOperation() bool

IsOperation is true if the method is an Operation.

func (*Method) IsPaged

func (m *Method) IsPaged() bool

IsPaged is true if the method paged.

func (*Method) MockHook

func (m *Method) MockHook() string

MockHook is the definition of the hook function.

func (*Method) MockHookName

func (m *Method) MockHookName() string

MockHookName is the name of the hook function in the mock.

func (*Method) Name

func (m *Method) Name() string

Name is the name of the method.

type MethodKind

type MethodKind int

MethodKind is the type of method that we are generated code for.

const (
	// MethodOperation is a long running method that returns an operation.
	MethodOperation MethodKind = iota
	// MethodGet is a method that immediately returns some data.
	MethodGet MethodKind = iota
	// MethodPaged is a method that returns a paged set of data.
	MethodPaged MethodKind = iota
)

type ServiceGroup

type ServiceGroup struct {
	Alpha *ServiceInfo
	Beta  *ServiceInfo
	GA    *ServiceInfo
}

ServiceGroup is a grouping of the same service but at different API versions.

func (*ServiceGroup) HasAlpha

func (sg *ServiceGroup) HasAlpha() bool

HasAlpha returns true if this object has a Alpha representation.

func (*ServiceGroup) HasBeta

func (sg *ServiceGroup) HasBeta() bool

HasBeta returns true if this object has a Beta representation.

func (*ServiceGroup) HasGA

func (sg *ServiceGroup) HasGA() bool

HasGA returns true if this object has a GA representation.

func (*ServiceGroup) Service

func (sg *ServiceGroup) Service() string

Service returns any ServiceInfo string belonging to the ServiceGroup.

func (*ServiceGroup) ServiceInfo

func (sg *ServiceGroup) ServiceInfo() *ServiceInfo

ServiceInfo returns any ServiceInfo object belonging to the ServiceGroup.

type ServiceInfo

type ServiceInfo struct {
	// Object is the Go name of the object type that the service deals
	// with. Example: "ForwardingRule".
	Object string
	// Service is the Go name of the service struct i.e. where the methods
	// are defined. Examples: "GlobalForwardingRules".
	Service string
	// Resource is the plural noun of the resource in the compute API URL (e.g.
	// "forwardingRules").
	Resource string
	// contains filtered or unexported fields
}

ServiceInfo defines the entry for a Service that code will be generated for.

func (*ServiceInfo) AggregatedList

func (i *ServiceInfo) AggregatedList() bool

AggregatedList is true if the method is to be generated.

func (*ServiceInfo) AggregatedListField

func (i *ServiceInfo) AggregatedListField() string

AggregatedListField is the name of the field used for the aggregated list call. This is typically the same as the name of the service, but can be customized by setting the aggregatedListField field.

func (*ServiceInfo) FQObjectType

func (i *ServiceInfo) FQObjectType() string

FQObjectType is fully qualified name of the object (e.g. compute.Instance).

func (*ServiceInfo) Field

func (i *ServiceInfo) Field() string

Field is the name of the GCE struct.

func (*ServiceInfo) GCEWrapType

func (i *ServiceInfo) GCEWrapType() string

GCEWrapType is the name of the GCE wrapper type.

func (*ServiceInfo) GenerateCustomOps

func (i *ServiceInfo) GenerateCustomOps() bool

GenerateCustomOps is true if we should generated a xxxOps interface for adding additional methods to the generated interface.

func (*ServiceInfo) GenerateDelete

func (i *ServiceInfo) GenerateDelete() bool

GenerateDelete is true if the method is to be generated.

func (*ServiceInfo) GenerateGet

func (i *ServiceInfo) GenerateGet() bool

GenerateGet is true if the method is to be generated.

func (*ServiceInfo) GenerateInsert

func (i *ServiceInfo) GenerateInsert() bool

GenerateInsert is true if the method is to be generated.

func (*ServiceInfo) GenerateList

func (i *ServiceInfo) GenerateList() bool

GenerateList is true if the method is to be generated.

func (*ServiceInfo) KeyIsGlobal

func (i *ServiceInfo) KeyIsGlobal() bool

KeyIsGlobal is true if the key is global.

func (*ServiceInfo) KeyIsProject

func (i *ServiceInfo) KeyIsProject() bool

KeyIsProject is true if the key represents the project resource.

func (*ServiceInfo) KeyIsRegional

func (i *ServiceInfo) KeyIsRegional() bool

KeyIsRegional is true if the key is regional.

func (*ServiceInfo) KeyIsZonal

func (i *ServiceInfo) KeyIsZonal() bool

KeyIsZonal is true if the key is zonal.

func (*ServiceInfo) MakeKey

func (i *ServiceInfo) MakeKey(name, location string) string

MakeKey returns the call used to create the appropriate key type.

func (*ServiceInfo) Methods

func (i *ServiceInfo) Methods() []*Method

Methods returns a list of additional methods to generate code for.

func (*ServiceInfo) MockField

func (i *ServiceInfo) MockField() string

MockField is the name of the field in the mock struct.

func (*ServiceInfo) MockWrapType

func (i *ServiceInfo) MockWrapType() string

MockWrapType is the name of the concrete mock for this type.

func (*ServiceInfo) ObjectAggregatedListType

func (i *ServiceInfo) ObjectAggregatedListType() string

ObjectAggregatedListType is the compute List type for the object (contains Items field).

func (*ServiceInfo) ObjectListType

func (i *ServiceInfo) ObjectListType() string

ObjectListType is the compute List type for the object (contains Items field).

func (*ServiceInfo) Version

func (i *ServiceInfo) Version() Version

Version returns the version of the Service, defaulting to GA if APIVersion is empty.

func (*ServiceInfo) VersionTitle

func (i *ServiceInfo) VersionTitle() string

VersionTitle returns the capitalized golang CamelCase name for the version.

func (*ServiceInfo) WrapType

func (i *ServiceInfo) WrapType() string

WrapType is the name of the wrapper service type.

func (*ServiceInfo) WrapTypeOps

func (i *ServiceInfo) WrapTypeOps() string

WrapTypeOps is the name of the additional operations type.

type Version

type Version string

Version of the API (ga, alpha, beta).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL