Documentation ¶
Overview ¶
Package meta contains the meta description of the GCE cloud types to generate code for.
Index ¶
- Constants
- Variables
- func KeysToMap(keys ...Key) map[Key]bool
- type Key
- type KeyType
- type Method
- func (m *Method) CallArgs() string
- func (m *Method) FcnArgs() string
- func (m *Method) InterfaceFunc() string
- func (m *Method) IsGet() bool
- func (m *Method) IsOperation() bool
- func (m *Method) IsPaged() bool
- func (m *Method) MockHook() string
- func (m *Method) MockHookName() string
- func (m *Method) Name() string
- type MethodKind
- type ServiceGroup
- type ServiceInfo
- func (i *ServiceInfo) AggregatedList() bool
- func (i *ServiceInfo) AggregatedListField() string
- func (i *ServiceInfo) FQObjectType() string
- func (i *ServiceInfo) Field() string
- func (i *ServiceInfo) GCEWrapType() string
- func (i *ServiceInfo) GenerateCustomOps() bool
- func (i *ServiceInfo) GenerateDelete() bool
- func (i *ServiceInfo) GenerateGet() bool
- func (i *ServiceInfo) GenerateInsert() bool
- func (i *ServiceInfo) GenerateList() bool
- func (i *ServiceInfo) KeyIsGlobal() bool
- func (i *ServiceInfo) KeyIsProject() bool
- func (i *ServiceInfo) KeyIsRegional() bool
- func (i *ServiceInfo) KeyIsZonal() bool
- func (i *ServiceInfo) MakeKey(name, location string) string
- func (i *ServiceInfo) Methods() []*Method
- func (i *ServiceInfo) MockField() string
- func (i *ServiceInfo) MockWrapType() string
- func (i *ServiceInfo) ObjectAggregatedListType() string
- func (i *ServiceInfo) ObjectListType() string
- func (i *ServiceInfo) Version() Version
- func (i *ServiceInfo) VersionTitle() string
- func (i *ServiceInfo) WrapType() string
- func (i *ServiceInfo) WrapTypeOps() string
- type Version
Constants ¶
const ( // Zonal key type. Zonal = "zonal" // Regional key type. Regional = "regional" // Global key type. Global = "global" )
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 ¶
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: "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: "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.
var AllServicesByGroup map[string]*ServiceGroup
AllServicesByGroup is a map of service name to ServicesGroup.
var AllVersions = []Version{ VersionGA, VersionAlpha, VersionBeta, }
AllVersions is a list of all versions of the GCE API.
var SortedServicesGroups []*ServiceGroup
SortedServicesGroups is a slice of Servicegroup sorted by Service name.
Functions ¶
Types ¶
type Key ¶
Key for a GCP resource.
func RegionalKey ¶
RegionalKey returns the key for a regional resource.
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 ¶
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) InterfaceFunc ¶
InterfaceFunc is the function declaration of the method in the interface.
func (*Method) IsOperation ¶
IsOperation is true if the method is an Operation.
func (*Method) MockHookName ¶
MockHookName is the name of the hook function in the mock.
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 ¶ added in v1.11.0
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 ¶ added in v1.11.0
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.