[WIP] provider/google: Update Container Engine features

1. Vendored google.golang.org/api packages were updated
This commit is contained in:
Evan Brown 2016-03-25 14:30:03 -07:00
parent e5713cadf8
commit 0d6a799e1f
19 changed files with 2174 additions and 1576 deletions

28
Godeps/Godeps.json generated
View File

@ -1300,23 +1300,23 @@
}, },
{ {
"ImportPath": "golang.org/x/oauth2", "ImportPath": "golang.org/x/oauth2",
"Rev": "8a57ed94ffd43444c0879fe75701732a38afc985" "Rev": "2897dcade18a126645f1368de827f1e613a60049"
}, },
{ {
"ImportPath": "golang.org/x/oauth2/google", "ImportPath": "golang.org/x/oauth2/google",
"Rev": "8a57ed94ffd43444c0879fe75701732a38afc985" "Rev": "2897dcade18a126645f1368de827f1e613a60049"
}, },
{ {
"ImportPath": "golang.org/x/oauth2/internal", "ImportPath": "golang.org/x/oauth2/internal",
"Rev": "8a57ed94ffd43444c0879fe75701732a38afc985" "Rev": "2897dcade18a126645f1368de827f1e613a60049"
}, },
{ {
"ImportPath": "golang.org/x/oauth2/jws", "ImportPath": "golang.org/x/oauth2/jws",
"Rev": "8a57ed94ffd43444c0879fe75701732a38afc985" "Rev": "2897dcade18a126645f1368de827f1e613a60049"
}, },
{ {
"ImportPath": "golang.org/x/oauth2/jwt", "ImportPath": "golang.org/x/oauth2/jwt",
"Rev": "8a57ed94ffd43444c0879fe75701732a38afc985" "Rev": "2897dcade18a126645f1368de827f1e613a60049"
}, },
{ {
"ImportPath": "golang.org/x/sys/unix", "ImportPath": "golang.org/x/sys/unix",
@ -1324,39 +1324,39 @@
}, },
{ {
"ImportPath": "google.golang.org/api/compute/v1", "ImportPath": "google.golang.org/api/compute/v1",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/container/v1", "ImportPath": "google.golang.org/api/container/v1",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/dns/v1", "ImportPath": "google.golang.org/api/dns/v1",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/gensupport", "ImportPath": "google.golang.org/api/gensupport",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/googleapi", "ImportPath": "google.golang.org/api/googleapi",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/googleapi/internal/uritemplates", "ImportPath": "google.golang.org/api/googleapi/internal/uritemplates",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/pubsub/v1", "ImportPath": "google.golang.org/api/pubsub/v1",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/sqladmin/v1beta4", "ImportPath": "google.golang.org/api/sqladmin/v1beta4",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/api/storage/v1", "ImportPath": "google.golang.org/api/storage/v1",
"Rev": "61d74df3f9f3a66898c8e08aa7e702337b34dda3" "Rev": "43c645d4bcf9251ced36c823a93b6d198764aae4"
}, },
{ {
"ImportPath": "google.golang.org/appengine", "ImportPath": "google.golang.org/appengine",

View File

@ -105,6 +105,7 @@ var brokenAuthHeaderProviders = []string{
"https://oauth.sandbox.trainingpeaks.com/", "https://oauth.sandbox.trainingpeaks.com/",
"https://oauth.trainingpeaks.com/", "https://oauth.trainingpeaks.com/",
"https://oauth.vk.com/", "https://oauth.vk.com/",
"https://openapi.baidu.com/",
"https://slack.com/", "https://slack.com/",
"https://test-sandbox.auth.corp.google.com", "https://test-sandbox.auth.corp.google.com",
"https://test.salesforce.com/", "https://test.salesforce.com/",
@ -113,6 +114,8 @@ var brokenAuthHeaderProviders = []string{
"https://www.googleapis.com/", "https://www.googleapis.com/",
"https://www.linkedin.com/", "https://www.linkedin.com/",
"https://www.strava.com/oauth/", "https://www.strava.com/oauth/",
"https://www.wunderlist.com/oauth/",
"https://api.patreon.com/",
} }
func RegisterBrokenAuthHeaderProvider(tokenURL string) { func RegisterBrokenAuthHeaderProvider(tokenURL string) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
{ {
"kind": "discovery#restDescription", "kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/-5Ir9-bAl4HnPM8XDQ5ycW_gSZQ\"", "etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/OU95LyfeHZcrBJDajlkYXi0P4Wo\"",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"id": "container:v1", "id": "container:v1",
"name": "container", "name": "container",
"version": "v1", "version": "v1",
"revision": "20150603", "revision": "20160321",
"title": "Google Container Engine API", "title": "Google Container Engine API",
"description": "The Google Container Engine API is used for building and managing container based applications, powered by the open source Kubernetes technology.", "description": "Builds and manages clusters that run container-based applications, powered by open source Kubernetes technology.",
"ownerDomain": "google.com", "ownerDomain": "google.com",
"ownerName": "Google", "ownerName": "Google",
"icons": { "icons": {
@ -121,6 +121,13 @@
"items": { "items": {
"$ref": "Cluster" "$ref": "Cluster"
} }
},
"missingZones": {
"type": "array",
"description": "If any zones are listed here, the list of clusters returned may be missing those zones.",
"items": {
"type": "string"
}
} }
} }
}, },
@ -139,33 +146,41 @@
}, },
"initialNodeCount": { "initialNodeCount": {
"type": "integer", "type": "integer",
"description": "The number of nodes to create in this cluster. You must ensure that your Compute Engine [resource quota](/compute/docs/resource-quotas) is sufficient for this number of instances. You must also have available firewall and routes quota.", "description": "The number of nodes to create in this cluster. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall and routes quota. For requests, this field should only be used in lieu of a \"node_pool\" object, since this configuration (along with the \"node_config\") will be used to create a \"NodePool\" object with an auto-generated name. Do not use this and a node_pool at the same time.",
"format": "int32" "format": "int32"
}, },
"nodeConfig": { "nodeConfig": {
"$ref": "NodeConfig", "$ref": "NodeConfig",
"description": "Parameters used in creating the cluster's nodes. See the descriptions of the child properties of `nodeConfig`. If unspecified, the defaults for all child properties are used." "description": "Parameters used in creating the cluster's nodes. See `nodeConfig` for the description of its properties. For requests, this field should only be used in lieu of a \"node_pool\" object, since this configuration (along with the \"initial_node_count\") will be used to create a \"NodePool\" object with an auto-generated name. Do not use this and a node_pool at the same time. For responses, this field will be populated with the node configuration of the first node pool. If unspecified, the defaults are used."
}, },
"masterAuth": { "masterAuth": {
"$ref": "MasterAuth", "$ref": "MasterAuth",
"description": "The authentication information for accessing the master." "description": "The authentication information for accessing the master endpoint."
}, },
"loggingService": { "loggingService": {
"type": "string", "type": "string",
"description": "The logging service that the cluster should write logs to. Currently available options: * \"logging.googleapis.com\" - the Google Cloud Logging service * \"none\" - no logs will be exported from the cluster * \"\" - default value; the default is \"logging.googleapis.com\"" "description": "The logging service the cluster should use to write logs. Currently available options: * `logging.googleapis.com` - the Google Cloud Logging service. * `none` - no logs will be exported from the cluster. * if left as an empty string,`logging.googleapis.com` will be used."
}, },
"monitoringService": { "monitoringService": {
"type": "string", "type": "string",
"description": "The monitoring service that the cluster should write metrics to. Currently available options: * \"monitoring.googleapis.com\" - the Google Cloud Monitoring service * \"none\" - no metrics will be exported from the cluster * \"\" - default value; the default is \"monitoring.googleapis.com\"" "description": "The monitoring service the cluster should use to write metrics. Currently available options: * `monitoring.googleapis.com` - the Google Cloud Monitoring service. * `none` - no metrics will be exported from the cluster. * if left as an empty string, `monitoring.googleapis.com` will be used."
}, },
"network": { "network": {
"type": "string", "type": "string",
"description": "The name of the Google Compute Engine [network](/compute/docs/networking#networks_1) to which the cluster is connected. If left unspecified, the \"default\" network will be used." "description": "The name of the Google Compute Engine [network](/compute/docs/networks-and-firewalls#networks) to which the cluster is connected. If left unspecified, the `default` network will be used."
}, },
"clusterIpv4Cidr": { "clusterIpv4Cidr": {
"type": "string", "type": "string",
"description": "The IP address range of the container pods in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`). Leave blank to have one automatically chosen or specify a `/14` block in `10.0.0.0/8`." "description": "The IP address range of the container pods in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`). Leave blank to have one automatically chosen or specify a `/14` block in `10.0.0.0/8`."
}, },
"addonsConfig": {
"$ref": "AddonsConfig",
"description": "Configurations for the various addons available to run in the cluster."
},
"subnetwork": {
"type": "string",
"description": "The name of the Google Compute Engine [subnetwork](/compute/docs/subnetworks) to which the cluster is connected."
},
"selfLink": { "selfLink": {
"type": "string", "type": "string",
"description": "[Output only] Server-defined URL for the resource." "description": "[Output only] Server-defined URL for the resource."
@ -176,11 +191,11 @@
}, },
"endpoint": { "endpoint": {
"type": "string", "type": "string",
"description": "[Output only] The IP address of this cluster's Kubernetes master endpoint. The endpoint can be accessed from the internet at `https://username:password@endpoint/`. See the `masterAuth` property of this resource for username and password information." "description": "[Output only] The IP address of this cluster's master endpoint. The endpoint can be accessed from the internet at `https://username:password@endpoint/`. See the `masterAuth` property of this resource for username and password information."
}, },
"initialClusterVersion": { "initialClusterVersion": {
"type": "string", "type": "string",
"description": "[Output only] The software version of Kubernetes master and kubelets used in the cluster when it was first created. The version can be upgraded over time." "description": "[Output only] The software version of the master endpoint and kubelets used in the cluster when it was first created. The version can be upgraded over time."
}, },
"currentMasterVersion": { "currentMasterVersion": {
"type": "string", "type": "string",
@ -188,7 +203,7 @@
}, },
"currentNodeVersion": { "currentNodeVersion": {
"type": "string", "type": "string",
"description": "[Output only] The current version of the node software components. If they are currently at different versions because they're in the process of being upgraded, this reflects the minimum version of any of them." "description": "[Output only] The current version of the node software components. If they are currently at multiple versions because they're in the process of being upgraded, this reflects the minimum version of all nodes."
}, },
"createTime": { "createTime": {
"type": "string", "type": "string",
@ -212,12 +227,12 @@
}, },
"nodeIpv4CidrSize": { "nodeIpv4CidrSize": {
"type": "integer", "type": "integer",
"description": "[Output only] The size of the address space on each node for hosting containers. This is provisioned from within the container_ipv4_cidr range.", "description": "[Output only] The size of the address space on each node for hosting containers. This is provisioned from within the `container_ipv4_cidr` range.",
"format": "int32" "format": "int32"
}, },
"servicesIpv4Cidr": { "servicesIpv4Cidr": {
"type": "string", "type": "string",
"description": "[Output only] The IP address range of the Kubernetes services in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `1.2.3.4/29`). Service addresses are typically put in the last /16 from the container CIDR." "description": "[Output only] The IP address range of the Kubernetes services in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `1.2.3.4/29`). Service addresses are typically put in the last `/16` from the container CIDR."
}, },
"instanceGroupUrls": { "instanceGroupUrls": {
"type": "array", "type": "array",
@ -225,13 +240,18 @@
"items": { "items": {
"type": "string" "type": "string"
} }
},
"currentNodeCount": {
"type": "integer",
"description": "[Output only] The number of nodes currently in the cluster.",
"format": "int32"
} }
} }
}, },
"NodeConfig": { "NodeConfig": {
"id": "NodeConfig", "id": "NodeConfig",
"type": "object", "type": "object",
"description": "Per-node parameters.", "description": "Parameters that describe the nodes in a cluster.",
"properties": { "properties": {
"machineType": { "machineType": {
"type": "string", "type": "string",
@ -244,10 +264,17 @@
}, },
"oauthScopes": { "oauthScopes": {
"type": "array", "type": "array",
"description": "The set of Google API scopes to be made available on all of the node VMs under the \"default\" service account. The following scopes are recommended, but not required, and by default are not included: * `https://www.googleapis.com/auth/compute` is required for mounting persistent storage on your nodes. * `https://www.googleapis.com/auth/devstorage.read_only` is required for communicating with *gcr.io*. If unspecified, no scopes are added.", "description": "The set of Google API scopes to be made available on all of the node VMs under the \"default\" service account. The following scopes are recommended, but not required, and by default are not included: * `https://www.googleapis.com/auth/compute` is required for mounting persistent storage on your nodes. * `https://www.googleapis.com/auth/devstorage.read_only` is required for communicating with **gcr.io** (the [Google Container Registry](/container-registry/)). If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.",
"items": { "items": {
"type": "string" "type": "string"
} }
},
"metadata": {
"type": "object",
"description": "The metadata key/value pairs assigned to instances in the cluster. Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. These are reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project or be one of the four reserved keys: \"instance-template\", \"kube-env\", \"startup-script\", and \"user-data\" Values are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on them is that each value's size must be less than or equal to 32 KB. The total size of all keys and values must be less than 512 KB.",
"additionalProperties": {
"type": "string"
}
} }
} }
}, },
@ -258,23 +285,60 @@
"properties": { "properties": {
"username": { "username": {
"type": "string", "type": "string",
"description": "The username to use for HTTP basic authentication when accessing the Kubernetes master endpoint." "description": "The username to use for HTTP basic authentication to the master endpoint."
}, },
"password": { "password": {
"type": "string", "type": "string",
"description": "The password to use for HTTP basic authentication when accessing the Kubernetes master endpoint. Because the master endpoint is open to the internet, you should create a strong password." "description": "The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password."
}, },
"clusterCaCertificate": { "clusterCaCertificate": {
"type": "string", "type": "string",
"description": "[Output only] Base64 encoded public certificate that is the root of trust for the cluster." "description": "[Output only] Base64-encoded public certificate that is the root of trust for the cluster."
}, },
"clientCertificate": { "clientCertificate": {
"type": "string", "type": "string",
"description": "[Output only] Base64 encoded public certificate used by clients to authenticate to the cluster endpoint." "description": "[Output only] Base64-encoded public certificate used by clients to authenticate to the cluster endpoint."
}, },
"clientKey": { "clientKey": {
"type": "string", "type": "string",
"description": "[Output only] Base64 encoded private key used by clients to authenticate to the cluster endpoint." "description": "[Output only] Base64-encoded private key used by clients to authenticate to the cluster endpoint."
}
}
},
"AddonsConfig": {
"id": "AddonsConfig",
"type": "object",
"description": "Configuration for the addons that can be automatically spun up in the cluster, enabling additional functionality.",
"properties": {
"httpLoadBalancing": {
"$ref": "HttpLoadBalancing",
"description": "Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster."
},
"horizontalPodAutoscaling": {
"$ref": "HorizontalPodAutoscaling",
"description": "Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods."
}
}
},
"HttpLoadBalancing": {
"id": "HttpLoadBalancing",
"type": "object",
"description": "Configuration options for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.",
"properties": {
"disabled": {
"type": "boolean",
"description": "Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, it runs a small pod in the cluster that manages the load balancers."
}
}
},
"HorizontalPodAutoscaling": {
"id": "HorizontalPodAutoscaling",
"type": "object",
"description": "Configuration options for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.",
"properties": {
"disabled": {
"type": "boolean",
"description": "Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that a Heapster pod is running in the cluster, which is also used by the Cloud Monitoring service."
} }
} }
}, },
@ -292,7 +356,7 @@
"Operation": { "Operation": {
"id": "Operation", "id": "Operation",
"type": "object", "type": "object",
"description": "Defines the operation resource. All fields are output only.", "description": "This operation resource represents operations that may have happened or are happening on the cluster. All fields are output only.",
"properties": { "properties": {
"name": { "name": {
"type": "string", "type": "string",
@ -311,7 +375,10 @@
"DELETE_CLUSTER", "DELETE_CLUSTER",
"UPGRADE_MASTER", "UPGRADE_MASTER",
"UPGRADE_NODES", "UPGRADE_NODES",
"REPAIR_CLUSTER" "REPAIR_CLUSTER",
"UPDATE_CLUSTER",
"CREATE_NODE_POOL",
"DELETE_NODE_POOL"
] ]
}, },
"status": { "status": {
@ -324,6 +391,10 @@
"DONE" "DONE"
] ]
}, },
"detail": {
"type": "string",
"description": "Detailed operation progress, if available."
},
"statusMessage": { "statusMessage": {
"type": "string", "type": "string",
"description": "If an error has occurred, a textual description of the error." "description": "If an error has occurred, a textual description of the error."
@ -341,7 +412,7 @@
"UpdateClusterRequest": { "UpdateClusterRequest": {
"id": "UpdateClusterRequest", "id": "UpdateClusterRequest",
"type": "object", "type": "object",
"description": "UpdateClusterRequest updates a cluster.", "description": "UpdateClusterRequest updates the settings of a cluster.",
"properties": { "properties": {
"update": { "update": {
"$ref": "ClusterUpdate", "$ref": "ClusterUpdate",
@ -352,11 +423,23 @@
"ClusterUpdate": { "ClusterUpdate": {
"id": "ClusterUpdate", "id": "ClusterUpdate",
"type": "object", "type": "object",
"description": "ClusterUpdate describes an update to the cluster.", "description": "ClusterUpdate describes an update to the cluster. Exactly one update can be applied to a cluster with each request, so at most one field can be provided.",
"properties": { "properties": {
"desiredNodeVersion": { "desiredNodeVersion": {
"type": "string", "type": "string",
"description": "The Kubernetes version to change the nodes to (typically an upgrade). Use \"-\" to upgrade to the latest version supported by the server." "description": "The Kubernetes version to change the nodes to (typically an upgrade). Use `-` to upgrade to the latest version supported by the server."
},
"desiredMonitoringService": {
"type": "string",
"description": "The monitoring service the cluster should use to write metrics. Currently available options: * \"monitoring.googleapis.com\" - the Google Cloud Monitoring service * \"none\" - no metrics will be exported from the cluster"
},
"desiredAddonsConfig": {
"$ref": "AddonsConfig",
"description": "Configurations for the various addons available to run in the cluster."
},
"desiredMasterVersion": {
"type": "string",
"description": "The Kubernetes version to change the master to. The only valid value is the latest supported version. Use \"-\" to have the server automatically select the latest version."
} }
} }
}, },
@ -371,17 +454,24 @@
"items": { "items": {
"$ref": "Operation" "$ref": "Operation"
} }
},
"missingZones": {
"type": "array",
"description": "If any zones are listed here, the list of operations returned may be missing the operations from those zones.",
"items": {
"type": "string"
}
} }
} }
}, },
"ServerConfig": { "ServerConfig": {
"id": "ServerConfig", "id": "ServerConfig",
"type": "object", "type": "object",
"description": "Container Engine Server configuration.", "description": "Container Engine service configuration.",
"properties": { "properties": {
"defaultClusterVersion": { "defaultClusterVersion": {
"type": "string", "type": "string",
"description": "What version this server deploys by default." "description": "Version of Kubernetes the service deploys by default."
}, },
"validNodeVersions": { "validNodeVersions": {
"type": "array", "type": "array",
@ -406,13 +496,13 @@
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
"zone": { "zone": {
"type": "string", "type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or \"-\" for all zones.", "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for.",
"required": true, "required": true,
"location": "path" "location": "path"
} }
@ -440,7 +530,7 @@
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
@ -466,11 +556,11 @@
"id": "container.projects.zones.clusters.get", "id": "container.projects.zones.clusters.get",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}", "path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}",
"httpMethod": "GET", "httpMethod": "GET",
"description": "Gets a specific cluster.", "description": "Gets the details of a specific cluster.",
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
@ -503,11 +593,11 @@
"id": "container.projects.zones.clusters.create", "id": "container.projects.zones.clusters.create",
"path": "v1/projects/{projectId}/zones/{zone}/clusters", "path": "v1/projects/{projectId}/zones/{zone}/clusters",
"httpMethod": "POST", "httpMethod": "POST",
"description": "Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master endpoint. By default, the cluster is created in the project's [default network](/compute/docs/networking#networks_1). One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster.", "description": "Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster.",
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
@ -536,11 +626,11 @@
"id": "container.projects.zones.clusters.update", "id": "container.projects.zones.clusters.update",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}", "path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}",
"httpMethod": "PUT", "httpMethod": "PUT",
"description": "Update settings of a specific cluster.", "description": "Updates the settings of a specific cluster.",
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
@ -576,11 +666,11 @@
"id": "container.projects.zones.clusters.delete", "id": "container.projects.zones.clusters.delete",
"path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}", "path": "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}",
"httpMethod": "DELETE", "httpMethod": "DELETE",
"description": "Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted.", "description": "Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster (e.g. load balancer resources) will not be deleted if they weren't present at the initial create time.",
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
@ -621,13 +711,13 @@
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },
"zone": { "zone": {
"type": "string", "type": "string",
"description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or \"-\" for all zones.", "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or `-` for all zones.",
"required": true, "required": true,
"location": "path" "location": "path"
} }
@ -651,7 +741,7 @@
"parameters": { "parameters": {
"projectId": { "projectId": {
"type": "string", "type": "string",
"description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
"required": true, "required": true,
"location": "path" "location": "path"
}, },

View File

@ -120,8 +120,42 @@ type ProjectsZonesOperationsService struct {
s *Service s *Service
} }
// AddonsConfig: Configuration for the addons that can be automatically
// spun up in the cluster, enabling additional functionality.
type AddonsConfig struct {
// HorizontalPodAutoscaling: Configuration for the horizontal pod
// autoscaling feature, which increases or decreases the number of
// replica pods a replication controller has based on the resource usage
// of the existing pods.
HorizontalPodAutoscaling *HorizontalPodAutoscaling `json:"horizontalPodAutoscaling,omitempty"`
// HttpLoadBalancing: Configuration for the HTTP (L7) load balancing
// controller addon, which makes it easy to set up HTTP load balancers
// for services in a cluster.
HttpLoadBalancing *HttpLoadBalancing `json:"httpLoadBalancing,omitempty"`
// ForceSendFields is a list of field names (e.g.
// "HorizontalPodAutoscaling") to unconditionally include in API
// requests. By default, fields with empty values are omitted from API
// requests. However, any non-pointer, non-interface field appearing in
// ForceSendFields will be sent to the server regardless of whether the
// field is empty or not. This may be used to include empty fields in
// Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *AddonsConfig) MarshalJSON() ([]byte, error) {
type noMethod AddonsConfig
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// Cluster: A Google Container Engine cluster. // Cluster: A Google Container Engine cluster.
type Cluster struct { type Cluster struct {
// AddonsConfig: Configurations for the various addons available to run
// in the cluster.
AddonsConfig *AddonsConfig `json:"addonsConfig,omitempty"`
// ClusterIpv4Cidr: The IP address range of the container pods in this // ClusterIpv4Cidr: The IP address range of the container pods in this
// cluster, in // cluster, in
// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
@ -137,51 +171,60 @@ type Cluster struct {
// the master endpoint. // the master endpoint.
CurrentMasterVersion string `json:"currentMasterVersion,omitempty"` CurrentMasterVersion string `json:"currentMasterVersion,omitempty"`
// CurrentNodeCount: [Output only] The number of nodes currently in the
// cluster.
CurrentNodeCount int64 `json:"currentNodeCount,omitempty"`
// CurrentNodeVersion: [Output only] The current version of the node // CurrentNodeVersion: [Output only] The current version of the node
// software components. If they are currently at different versions // software components. If they are currently at multiple versions
// because they're in the process of being upgraded, this reflects the // because they're in the process of being upgraded, this reflects the
// minimum version of any of them. // minimum version of all nodes.
CurrentNodeVersion string `json:"currentNodeVersion,omitempty"` CurrentNodeVersion string `json:"currentNodeVersion,omitempty"`
// Description: An optional description of this cluster. // Description: An optional description of this cluster.
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
// Endpoint: [Output only] The IP address of this cluster's Kubernetes // Endpoint: [Output only] The IP address of this cluster's master
// master endpoint. The endpoint can be accessed from the internet at // endpoint. The endpoint can be accessed from the internet at
// `https://username:password@endpoint/`. See the `masterAuth` property // `https://username:password@endpoint/`. See the `masterAuth` property
// of this resource for username and password information. // of this resource for username and password information.
Endpoint string `json:"endpoint,omitempty"` Endpoint string `json:"endpoint,omitempty"`
// InitialClusterVersion: [Output only] The software version of // InitialClusterVersion: [Output only] The software version of the
// Kubernetes master and kubelets used in the cluster when it was first // master endpoint and kubelets used in the cluster when it was first
// created. The version can be upgraded over time. // created. The version can be upgraded over time.
InitialClusterVersion string `json:"initialClusterVersion,omitempty"` InitialClusterVersion string `json:"initialClusterVersion,omitempty"`
// InitialNodeCount: The number of nodes to create in this cluster. You // InitialNodeCount: The number of nodes to create in this cluster. You
// must ensure that your Compute Engine [resource // must ensure that your Compute Engine resource quota is sufficient for
// quota](/compute/docs/resource-quotas) is sufficient for this number // this number of instances. You must also have available firewall and
// of instances. You must also have available firewall and routes quota. // routes quota. For requests, this field should only be used in lieu of
// a "node_pool" object, since this configuration (along with the
// "node_config") will be used to create a "NodePool" object with an
// auto-generated name. Do not use this and a node_pool at the same
// time.
InitialNodeCount int64 `json:"initialNodeCount,omitempty"` InitialNodeCount int64 `json:"initialNodeCount,omitempty"`
// InstanceGroupUrls: [Output only] The resource URLs of [instance // InstanceGroupUrls: [Output only] The resource URLs of [instance
// groups](/compute/docs/instance-groups/) associated with this cluster. // groups](/compute/docs/instance-groups/) associated with this cluster.
InstanceGroupUrls []string `json:"instanceGroupUrls,omitempty"` InstanceGroupUrls []string `json:"instanceGroupUrls,omitempty"`
// LoggingService: The logging service that the cluster should write // LoggingService: The logging service the cluster should use to write
// logs to. Currently available options: * "logging.googleapis.com" - // logs. Currently available options: * `logging.googleapis.com` - the
// the Google Cloud Logging service * "none" - no logs will be exported // Google Cloud Logging service. * `none` - no logs will be exported
// from the cluster * "" - default value; the default is // from the cluster. * if left as an empty
// "logging.googleapis.com" // string,`logging.googleapis.com` will be used.
LoggingService string `json:"loggingService,omitempty"` LoggingService string `json:"loggingService,omitempty"`
// MasterAuth: The authentication information for accessing the master. // MasterAuth: The authentication information for accessing the master
// endpoint.
MasterAuth *MasterAuth `json:"masterAuth,omitempty"` MasterAuth *MasterAuth `json:"masterAuth,omitempty"`
// MonitoringService: The monitoring service that the cluster should // MonitoringService: The monitoring service the cluster should use to
// write metrics to. Currently available options: * // write metrics. Currently available options: *
// "monitoring.googleapis.com" - the Google Cloud Monitoring service * // `monitoring.googleapis.com` - the Google Cloud Monitoring service. *
// "none" - no metrics will be exported from the cluster * "" - default // `none` - no metrics will be exported from the cluster. * if left as
// value; the default is "monitoring.googleapis.com" // an empty string, `monitoring.googleapis.com` will be used.
MonitoringService string `json:"monitoringService,omitempty"` MonitoringService string `json:"monitoringService,omitempty"`
// Name: The name of this cluster. The name must be unique within this // Name: The name of this cluster. The name must be unique within this
@ -191,19 +234,24 @@ type Cluster struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
// Network: The name of the Google Compute Engine // Network: The name of the Google Compute Engine
// [network](/compute/docs/networking#networks_1) to which the cluster // [network](/compute/docs/networks-and-firewalls#networks) to which the
// is connected. If left unspecified, the "default" network will be // cluster is connected. If left unspecified, the `default` network will
// used. // be used.
Network string `json:"network,omitempty"` Network string `json:"network,omitempty"`
// NodeConfig: Parameters used in creating the cluster's nodes. See the // NodeConfig: Parameters used in creating the cluster's nodes. See
// descriptions of the child properties of `nodeConfig`. If unspecified, // `nodeConfig` for the description of its properties. For requests,
// the defaults for all child properties are used. // this field should only be used in lieu of a "node_pool" object, since
// this configuration (along with the "initial_node_count") will be used
// to create a "NodePool" object with an auto-generated name. Do not use
// this and a node_pool at the same time. For responses, this field will
// be populated with the node configuration of the first node pool. If
// unspecified, the defaults are used.
NodeConfig *NodeConfig `json:"nodeConfig,omitempty"` NodeConfig *NodeConfig `json:"nodeConfig,omitempty"`
// NodeIpv4CidrSize: [Output only] The size of the address space on each // NodeIpv4CidrSize: [Output only] The size of the address space on each
// node for hosting containers. This is provisioned from within the // node for hosting containers. This is provisioned from within the
// container_ipv4_cidr range. // `container_ipv4_cidr` range.
NodeIpv4CidrSize int64 `json:"nodeIpv4CidrSize,omitempty"` NodeIpv4CidrSize int64 `json:"nodeIpv4CidrSize,omitempty"`
// SelfLink: [Output only] Server-defined URL for the resource. // SelfLink: [Output only] Server-defined URL for the resource.
@ -213,7 +261,7 @@ type Cluster struct {
// Kubernetes services in this cluster, in // Kubernetes services in this cluster, in
// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) // [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// notation (e.g. `1.2.3.4/29`). Service addresses are typically put in // notation (e.g. `1.2.3.4/29`). Service addresses are typically put in
// the last /16 from the container CIDR. // the last `/16` from the container CIDR.
ServicesIpv4Cidr string `json:"servicesIpv4Cidr,omitempty"` ServicesIpv4Cidr string `json:"servicesIpv4Cidr,omitempty"`
// Status: [Output only] The current status of this cluster. // Status: [Output only] The current status of this cluster.
@ -231,6 +279,11 @@ type Cluster struct {
// status of this cluster, if available. // status of this cluster, if available.
StatusMessage string `json:"statusMessage,omitempty"` StatusMessage string `json:"statusMessage,omitempty"`
// Subnetwork: The name of the Google Compute Engine
// [subnetwork](/compute/docs/subnetworks) to which the cluster is
// connected.
Subnetwork string `json:"subnetwork,omitempty"`
// Zone: [Output only] The name of the Google Compute Engine // Zone: [Output only] The name of the Google Compute Engine
// [zone](/compute/docs/zones#available) in which the cluster resides. // [zone](/compute/docs/zones#available) in which the cluster resides.
Zone string `json:"zone,omitempty"` Zone string `json:"zone,omitempty"`
@ -239,7 +292,7 @@ type Cluster struct {
// server. // server.
googleapi.ServerResponse `json:"-"` googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "ClusterIpv4Cidr") to // ForceSendFields is a list of field names (e.g. "AddonsConfig") to
// unconditionally include in API requests. By default, fields with // unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer, // empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the // non-interface field appearing in ForceSendFields will be sent to the
@ -255,13 +308,30 @@ func (s *Cluster) MarshalJSON() ([]byte, error) {
} }
// ClusterUpdate: ClusterUpdate describes an update to the cluster. // ClusterUpdate: ClusterUpdate describes an update to the cluster.
// Exactly one update can be applied to a cluster with each request, so
// at most one field can be provided.
type ClusterUpdate struct { type ClusterUpdate struct {
// DesiredAddonsConfig: Configurations for the various addons available
// to run in the cluster.
DesiredAddonsConfig *AddonsConfig `json:"desiredAddonsConfig,omitempty"`
// DesiredMasterVersion: The Kubernetes version to change the master to.
// The only valid value is the latest supported version. Use "-" to have
// the server automatically select the latest version.
DesiredMasterVersion string `json:"desiredMasterVersion,omitempty"`
// DesiredMonitoringService: The monitoring service the cluster should
// use to write metrics. Currently available options: *
// "monitoring.googleapis.com" - the Google Cloud Monitoring service *
// "none" - no metrics will be exported from the cluster
DesiredMonitoringService string `json:"desiredMonitoringService,omitempty"`
// DesiredNodeVersion: The Kubernetes version to change the nodes to // DesiredNodeVersion: The Kubernetes version to change the nodes to
// (typically an upgrade). Use "-" to upgrade to the latest version // (typically an upgrade). Use `-` to upgrade to the latest version
// supported by the server. // supported by the server.
DesiredNodeVersion string `json:"desiredNodeVersion,omitempty"` DesiredNodeVersion string `json:"desiredNodeVersion,omitempty"`
// ForceSendFields is a list of field names (e.g. "DesiredNodeVersion") // ForceSendFields is a list of field names (e.g. "DesiredAddonsConfig")
// to unconditionally include in API requests. By default, fields with // to unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer, // empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the // non-interface field appearing in ForceSendFields will be sent to the
@ -297,6 +367,56 @@ func (s *CreateClusterRequest) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields) return gensupport.MarshalJSON(raw, s.ForceSendFields)
} }
// HorizontalPodAutoscaling: Configuration options for the horizontal
// pod autoscaling feature, which increases or decreases the number of
// replica pods a replication controller has based on the resource usage
// of the existing pods.
type HorizontalPodAutoscaling struct {
// Disabled: Whether the Horizontal Pod Autoscaling feature is enabled
// in the cluster. When enabled, it ensures that a Heapster pod is
// running in the cluster, which is also used by the Cloud Monitoring
// service.
Disabled bool `json:"disabled,omitempty"`
// ForceSendFields is a list of field names (e.g. "Disabled") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *HorizontalPodAutoscaling) MarshalJSON() ([]byte, error) {
type noMethod HorizontalPodAutoscaling
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// HttpLoadBalancing: Configuration options for the HTTP (L7) load
// balancing controller addon, which makes it easy to set up HTTP load
// balancers for services in a cluster.
type HttpLoadBalancing struct {
// Disabled: Whether the HTTP Load Balancing controller is enabled in
// the cluster. When enabled, it runs a small pod in the cluster that
// manages the load balancers.
Disabled bool `json:"disabled,omitempty"`
// ForceSendFields is a list of field names (e.g. "Disabled") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *HttpLoadBalancing) MarshalJSON() ([]byte, error) {
type noMethod HttpLoadBalancing
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ListClustersResponse: ListClustersResponse is the result of // ListClustersResponse: ListClustersResponse is the result of
// ListClustersRequest. // ListClustersRequest.
type ListClustersResponse struct { type ListClustersResponse struct {
@ -304,6 +424,10 @@ type ListClustersResponse struct {
// across all ones. // across all ones.
Clusters []*Cluster `json:"clusters,omitempty"` Clusters []*Cluster `json:"clusters,omitempty"`
// MissingZones: If any zones are listed here, the list of clusters
// returned may be missing those zones.
MissingZones []string `json:"missingZones,omitempty"`
// ServerResponse contains the HTTP response code and headers from the // ServerResponse contains the HTTP response code and headers from the
// server. // server.
googleapi.ServerResponse `json:"-"` googleapi.ServerResponse `json:"-"`
@ -326,6 +450,10 @@ func (s *ListClustersResponse) MarshalJSON() ([]byte, error) {
// ListOperationsResponse: ListOperationsResponse is the result of // ListOperationsResponse: ListOperationsResponse is the result of
// ListOperationsRequest. // ListOperationsRequest.
type ListOperationsResponse struct { type ListOperationsResponse struct {
// MissingZones: If any zones are listed here, the list of operations
// returned may be missing the operations from those zones.
MissingZones []string `json:"missingZones,omitempty"`
// Operations: A list of operations in the project in the specified // Operations: A list of operations in the project in the specified
// zone. // zone.
Operations []*Operation `json:"operations,omitempty"` Operations []*Operation `json:"operations,omitempty"`
@ -334,7 +462,7 @@ type ListOperationsResponse struct {
// server. // server.
googleapi.ServerResponse `json:"-"` googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Operations") to // ForceSendFields is a list of field names (e.g. "MissingZones") to
// unconditionally include in API requests. By default, fields with // unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer, // empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the // non-interface field appearing in ForceSendFields will be sent to the
@ -353,25 +481,25 @@ func (s *ListOperationsResponse) MarshalJSON() ([]byte, error) {
// endpoint. Authentication can be done using HTTP basic auth or using // endpoint. Authentication can be done using HTTP basic auth or using
// client certificates. // client certificates.
type MasterAuth struct { type MasterAuth struct {
// ClientCertificate: [Output only] Base64 encoded public certificate // ClientCertificate: [Output only] Base64-encoded public certificate
// used by clients to authenticate to the cluster endpoint. // used by clients to authenticate to the cluster endpoint.
ClientCertificate string `json:"clientCertificate,omitempty"` ClientCertificate string `json:"clientCertificate,omitempty"`
// ClientKey: [Output only] Base64 encoded private key used by clients // ClientKey: [Output only] Base64-encoded private key used by clients
// to authenticate to the cluster endpoint. // to authenticate to the cluster endpoint.
ClientKey string `json:"clientKey,omitempty"` ClientKey string `json:"clientKey,omitempty"`
// ClusterCaCertificate: [Output only] Base64 encoded public certificate // ClusterCaCertificate: [Output only] Base64-encoded public certificate
// that is the root of trust for the cluster. // that is the root of trust for the cluster.
ClusterCaCertificate string `json:"clusterCaCertificate,omitempty"` ClusterCaCertificate string `json:"clusterCaCertificate,omitempty"`
// Password: The password to use for HTTP basic authentication when // Password: The password to use for HTTP basic authentication to the
// accessing the Kubernetes master endpoint. Because the master endpoint // master endpoint. Because the master endpoint is open to the Internet,
// is open to the internet, you should create a strong password. // you should create a strong password.
Password string `json:"password,omitempty"` Password string `json:"password,omitempty"`
// Username: The username to use for HTTP basic authentication when // Username: The username to use for HTTP basic authentication to the
// accessing the Kubernetes master endpoint. // master endpoint.
Username string `json:"username,omitempty"` Username string `json:"username,omitempty"`
// ForceSendFields is a list of field names (e.g. "ClientCertificate") // ForceSendFields is a list of field names (e.g. "ClientCertificate")
@ -389,7 +517,7 @@ func (s *MasterAuth) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields) return gensupport.MarshalJSON(raw, s.ForceSendFields)
} }
// NodeConfig: Per-node parameters. // NodeConfig: Parameters that describe the nodes in a cluster.
type NodeConfig struct { type NodeConfig struct {
// DiskSizeGb: Size of the disk attached to each node, specified in GB. // DiskSizeGb: Size of the disk attached to each node, specified in GB.
// The smallest allowed disk size is 10GB. If unspecified, the default // The smallest allowed disk size is 10GB. If unspecified, the default
@ -401,13 +529,29 @@ type NodeConfig struct {
// unspecified, the default machine type is `n1-standard-1`. // unspecified, the default machine type is `n1-standard-1`.
MachineType string `json:"machineType,omitempty"` MachineType string `json:"machineType,omitempty"`
// Metadata: The metadata key/value pairs assigned to instances in the
// cluster. Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less
// than 128 bytes in length. These are reflected as part of a URL in the
// metadata server. Additionally, to avoid ambiguity, keys must not
// conflict with any other metadata keys for the project or be one of
// the four reserved keys: "instance-template", "kube-env",
// "startup-script", and "user-data" Values are free-form strings, and
// only have meaning as interpreted by the image running in the
// instance. The only restriction placed on them is that each value's
// size must be less than or equal to 32 KB. The total size of all keys
// and values must be less than 512 KB.
Metadata map[string]string `json:"metadata,omitempty"`
// OauthScopes: The set of Google API scopes to be made available on all // OauthScopes: The set of Google API scopes to be made available on all
// of the node VMs under the "default" service account. The following // of the node VMs under the "default" service account. The following
// scopes are recommended, but not required, and by default are not // scopes are recommended, but not required, and by default are not
// included: * `https://www.googleapis.com/auth/compute` is required for // included: * `https://www.googleapis.com/auth/compute` is required for
// mounting persistent storage on your nodes. * // mounting persistent storage on your nodes. *
// `https://www.googleapis.com/auth/devstorage.read_only` is required // `https://www.googleapis.com/auth/devstorage.read_only` is required
// for communicating with *gcr.io*. If unspecified, no scopes are added. // for communicating with **gcr.io** (the [Google Container
// Registry](/container-registry/)). If unspecified, no scopes are
// added, unless Cloud Logging or Cloud Monitoring are enabled, in which
// case their required scopes will be added.
OauthScopes []string `json:"oauthScopes,omitempty"` OauthScopes []string `json:"oauthScopes,omitempty"`
// ForceSendFields is a list of field names (e.g. "DiskSizeGb") to // ForceSendFields is a list of field names (e.g. "DiskSizeGb") to
@ -425,9 +569,13 @@ func (s *NodeConfig) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields) return gensupport.MarshalJSON(raw, s.ForceSendFields)
} }
// Operation: Defines the operation resource. All fields are output // Operation: This operation resource represents operations that may
// have happened or are happening on the cluster. All fields are output
// only. // only.
type Operation struct { type Operation struct {
// Detail: Detailed operation progress, if available.
Detail string `json:"detail,omitempty"`
// Name: The server-assigned ID for the operation. // Name: The server-assigned ID for the operation.
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
@ -440,6 +588,9 @@ type Operation struct {
// "UPGRADE_MASTER" // "UPGRADE_MASTER"
// "UPGRADE_NODES" // "UPGRADE_NODES"
// "REPAIR_CLUSTER" // "REPAIR_CLUSTER"
// "UPDATE_CLUSTER"
// "CREATE_NODE_POOL"
// "DELETE_NODE_POOL"
OperationType string `json:"operationType,omitempty"` OperationType string `json:"operationType,omitempty"`
// SelfLink: Server-defined URL for the resource. // SelfLink: Server-defined URL for the resource.
@ -470,7 +621,7 @@ type Operation struct {
// server. // server.
googleapi.ServerResponse `json:"-"` googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Name") to // ForceSendFields is a list of field names (e.g. "Detail") to
// unconditionally include in API requests. By default, fields with // unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer, // empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the // non-interface field appearing in ForceSendFields will be sent to the
@ -485,9 +636,10 @@ func (s *Operation) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields) return gensupport.MarshalJSON(raw, s.ForceSendFields)
} }
// ServerConfig: Container Engine Server configuration. // ServerConfig: Container Engine service configuration.
type ServerConfig struct { type ServerConfig struct {
// DefaultClusterVersion: What version this server deploys by default. // DefaultClusterVersion: Version of Kubernetes the service deploys by
// default.
DefaultClusterVersion string `json:"defaultClusterVersion,omitempty"` DefaultClusterVersion string `json:"defaultClusterVersion,omitempty"`
// ValidNodeVersions: List of valid node upgrade target versions. // ValidNodeVersions: List of valid node upgrade target versions.
@ -513,7 +665,8 @@ func (s *ServerConfig) MarshalJSON() ([]byte, error) {
return gensupport.MarshalJSON(raw, s.ForceSendFields) return gensupport.MarshalJSON(raw, s.ForceSendFields)
} }
// UpdateClusterRequest: UpdateClusterRequest updates a cluster. // UpdateClusterRequest: UpdateClusterRequest updates the settings of a
// cluster.
type UpdateClusterRequest struct { type UpdateClusterRequest struct {
// Update: A description of the update. // Update: A description of the update.
Update *ClusterUpdate `json:"update,omitempty"` Update *ClusterUpdate `json:"update,omitempty"`
@ -645,13 +798,13 @@ func (c *ProjectsZonesGetServerconfigCall) Do(opts ...googleapi.CallOption) (*Se
// ], // ],
// "parameters": { // "parameters": {
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
// }, // },
// "zone": { // "zone": {
// "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or \"-\" for all zones.", // "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for.",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -680,9 +833,9 @@ type ProjectsZonesClustersCreateCall struct {
} }
// Create: Creates a cluster, consisting of the specified number and // Create: Creates a cluster, consisting of the specified number and
// type of Google Compute Engine instances, plus a Kubernetes master // type of Google Compute Engine instances. By default, the cluster is
// endpoint. By default, the cluster is created in the project's // created in the project's [default
// [default network](/compute/docs/networking#networks_1). One firewall // network](/compute/docs/networks-and-firewalls#networks). One firewall
// is added for the cluster. After cluster creation, the cluster creates // is added for the cluster. After cluster creation, the cluster creates
// routes for each node to allow the containers on that node to // routes for each node to allow the containers on that node to
// communicate with all other instances in the cluster. Finally, an // communicate with all other instances in the cluster. Finally, an
@ -772,7 +925,7 @@ func (c *ProjectsZonesClustersCreateCall) Do(opts ...googleapi.CallOption) (*Ope
} }
return ret, nil return ret, nil
// { // {
// "description": "Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master endpoint. By default, the cluster is created in the project's [default network](/compute/docs/networking#networks_1). One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster.", // "description": "Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster.",
// "httpMethod": "POST", // "httpMethod": "POST",
// "id": "container.projects.zones.clusters.create", // "id": "container.projects.zones.clusters.create",
// "parameterOrder": [ // "parameterOrder": [
@ -781,7 +934,7 @@ func (c *ProjectsZonesClustersCreateCall) Do(opts ...googleapi.CallOption) (*Ope
// ], // ],
// "parameters": { // "parameters": {
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -820,7 +973,10 @@ type ProjectsZonesClustersDeleteCall struct {
// Delete: Deletes the cluster, including the Kubernetes endpoint and // Delete: Deletes the cluster, including the Kubernetes endpoint and
// all worker nodes. Firewalls and routes that were configured during // all worker nodes. Firewalls and routes that were configured during
// cluster creation are also deleted. // cluster creation are also deleted. Other Google Compute Engine
// resources that might be in use by the cluster (e.g. load balancer
// resources) will not be deleted if they weren't present at the initial
// create time.
func (r *ProjectsZonesClustersService) Delete(projectId string, zone string, clusterId string) *ProjectsZonesClustersDeleteCall { func (r *ProjectsZonesClustersService) Delete(projectId string, zone string, clusterId string) *ProjectsZonesClustersDeleteCall {
c := &ProjectsZonesClustersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} c := &ProjectsZonesClustersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.projectId = projectId c.projectId = projectId
@ -900,7 +1056,7 @@ func (c *ProjectsZonesClustersDeleteCall) Do(opts ...googleapi.CallOption) (*Ope
} }
return ret, nil return ret, nil
// { // {
// "description": "Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted.", // "description": "Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster (e.g. load balancer resources) will not be deleted if they weren't present at the initial create time.",
// "httpMethod": "DELETE", // "httpMethod": "DELETE",
// "id": "container.projects.zones.clusters.delete", // "id": "container.projects.zones.clusters.delete",
// "parameterOrder": [ // "parameterOrder": [
@ -916,7 +1072,7 @@ func (c *ProjectsZonesClustersDeleteCall) Do(opts ...googleapi.CallOption) (*Ope
// "type": "string" // "type": "string"
// }, // },
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -951,7 +1107,7 @@ type ProjectsZonesClustersGetCall struct {
ctx_ context.Context ctx_ context.Context
} }
// Get: Gets a specific cluster. // Get: Gets the details of a specific cluster.
func (r *ProjectsZonesClustersService) Get(projectId string, zone string, clusterId string) *ProjectsZonesClustersGetCall { func (r *ProjectsZonesClustersService) Get(projectId string, zone string, clusterId string) *ProjectsZonesClustersGetCall {
c := &ProjectsZonesClustersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} c := &ProjectsZonesClustersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.projectId = projectId c.projectId = projectId
@ -1044,7 +1200,7 @@ func (c *ProjectsZonesClustersGetCall) Do(opts ...googleapi.CallOption) (*Cluste
} }
return ret, nil return ret, nil
// { // {
// "description": "Gets a specific cluster.", // "description": "Gets the details of a specific cluster.",
// "httpMethod": "GET", // "httpMethod": "GET",
// "id": "container.projects.zones.clusters.get", // "id": "container.projects.zones.clusters.get",
// "parameterOrder": [ // "parameterOrder": [
@ -1060,7 +1216,7 @@ func (c *ProjectsZonesClustersGetCall) Do(opts ...googleapi.CallOption) (*Cluste
// "type": "string" // "type": "string"
// }, // },
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -1195,7 +1351,7 @@ func (c *ProjectsZonesClustersListCall) Do(opts ...googleapi.CallOption) (*ListC
// ], // ],
// "parameters": { // "parameters": {
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -1230,7 +1386,7 @@ type ProjectsZonesClustersUpdateCall struct {
ctx_ context.Context ctx_ context.Context
} }
// Update: Update settings of a specific cluster. // Update: Updates the settings of a specific cluster.
func (r *ProjectsZonesClustersService) Update(projectId string, zone string, clusterId string, updateclusterrequest *UpdateClusterRequest) *ProjectsZonesClustersUpdateCall { func (r *ProjectsZonesClustersService) Update(projectId string, zone string, clusterId string, updateclusterrequest *UpdateClusterRequest) *ProjectsZonesClustersUpdateCall {
c := &ProjectsZonesClustersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} c := &ProjectsZonesClustersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.projectId = projectId c.projectId = projectId
@ -1317,7 +1473,7 @@ func (c *ProjectsZonesClustersUpdateCall) Do(opts ...googleapi.CallOption) (*Ope
} }
return ret, nil return ret, nil
// { // {
// "description": "Update settings of a specific cluster.", // "description": "Updates the settings of a specific cluster.",
// "httpMethod": "PUT", // "httpMethod": "PUT",
// "id": "container.projects.zones.clusters.update", // "id": "container.projects.zones.clusters.update",
// "parameterOrder": [ // "parameterOrder": [
@ -1333,7 +1489,7 @@ func (c *ProjectsZonesClustersUpdateCall) Do(opts ...googleapi.CallOption) (*Ope
// "type": "string" // "type": "string"
// }, // },
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -1480,7 +1636,7 @@ func (c *ProjectsZonesOperationsGetCall) Do(opts ...googleapi.CallOption) (*Oper
// "type": "string" // "type": "string"
// }, // },
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
@ -1615,13 +1771,13 @@ func (c *ProjectsZonesOperationsListCall) Do(opts ...googleapi.CallOption) (*Lis
// ], // ],
// "parameters": { // "parameters": {
// "projectId": { // "projectId": {
// "description": "The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber).", // "description": "The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"
// }, // },
// "zone": { // "zone": {
// "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or \"-\" for all zones.", // "description": "The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for, or `-` for all zones.",
// "location": "path", // "location": "path",
// "required": true, // "required": true,
// "type": "string" // "type": "string"

View File

@ -1,11 +1,11 @@
{ {
"kind": "discovery#restDescription", "kind": "discovery#restDescription",
"etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/zoueaaoAZQGFJohVmI5skQDTvqg\"", "etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/YvTvEjSR_sXxd8XvUihYx8e9Xjo\"",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"id": "dns:v1", "id": "dns:v1",
"name": "dns", "name": "dns",
"version": "v1", "version": "v1",
"revision": "20150729", "revision": "20160209",
"title": "Google Cloud DNS API", "title": "Google Cloud DNS API",
"description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.", "description": "The Google Cloud DNS API provides services for configuring and serving authoritative DNS records.",
"ownerDomain": "google.com", "ownerDomain": "google.com",
@ -115,7 +115,7 @@
}, },
"startTime": { "startTime": {
"type": "string", "type": "string",
"description": "The time that this operation was started by the server. This is in RFC3339 text format." "description": "The time that this operation was started by the server (output only). This is in RFC3339 text format."
}, },
"status": { "status": {
"type": "string", "type": "string",

View File

@ -146,8 +146,8 @@ type Change struct {
// string "dns#change". // string "dns#change".
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty"`
// StartTime: The time that this operation was started by the server. // StartTime: The time that this operation was started by the server
// This is in RFC3339 text format. // (output only). This is in RFC3339 text format.
StartTime string `json:"startTime,omitempty"` StartTime string `json:"startTime,omitempty"`
// Status: Status of the operation (output only). // Status: Status of the operation (output only).

View File

@ -4,31 +4,43 @@
package gensupport package gensupport
import "time" import (
"math/rand"
"time"
)
type BackoffStrategy interface { type BackoffStrategy interface {
// Pause returns the duration of the next pause before a retry should be attempted. // Pause returns the duration of the next pause and true if the operation should be
Pause() time.Duration // retried, or false if no further retries should be attempted.
Pause() (time.Duration, bool)
// Reset restores the strategy to its initial state. // Reset restores the strategy to its initial state.
Reset() Reset()
} }
// ExponentialBackoff performs exponential backoff as per https://en.wikipedia.org/wiki/Exponential_backoff.
// The initial pause time is given by Base.
// Once the total pause time exceeds Max, Pause will indicate no further retries.
type ExponentialBackoff struct { type ExponentialBackoff struct {
BasePause time.Duration Base time.Duration
nextPause time.Duration Max time.Duration
total time.Duration
n uint
} }
func (eb *ExponentialBackoff) Pause() time.Duration { func (eb *ExponentialBackoff) Pause() (time.Duration, bool) {
if eb.nextPause == 0 { if eb.total > eb.Max {
eb.Reset() return 0, false
} }
d := eb.nextPause // The next pause is selected from randomly from [0, 2^n * Base).
eb.nextPause *= 2 d := time.Duration(rand.Int63n((1 << eb.n) * int64(eb.Base)))
return d eb.total += d
eb.n++
return d, true
} }
func (eb *ExponentialBackoff) Reset() { func (eb *ExponentialBackoff) Reset() {
eb.nextPause = eb.BasePause eb.n = 0
eb.total = 0
} }

View File

@ -165,7 +165,9 @@ func CombineBodyMedia(body io.Reader, bodyContentType string, media io.Reader, m
func typeHeader(contentType string) textproto.MIMEHeader { func typeHeader(contentType string) textproto.MIMEHeader {
h := make(textproto.MIMEHeader) h := make(textproto.MIMEHeader)
h.Set("Content-Type", contentType) if contentType != "" {
h.Set("Content-Type", contentType)
}
return h return h
} }

View File

@ -16,14 +16,16 @@ import (
) )
const ( const (
// statusResumeIncomplete is the code returned by the Google uploader when the transfer is not yet complete. // statusResumeIncomplete is the code returned by the Google uploader
// when the transfer is not yet complete.
statusResumeIncomplete = 308 statusResumeIncomplete = 308
)
// DefaultBackoffStrategy returns a default strategy to use for retrying failed upload requests. // statusTooManyRequests is returned by the storage API if the
func DefaultBackoffStrategy() BackoffStrategy { // per-project limits have been temporarily exceeded. The request
return &ExponentialBackoff{BasePause: time.Second} // should be retried.
} // https://cloud.google.com/storage/docs/json_api/v1/status-codes#standardcodes
statusTooManyRequests = 429
)
// ResumableUpload is used by the generated APIs to provide resumable uploads. // ResumableUpload is used by the generated APIs to provide resumable uploads.
// It is not used by developers directly. // It is not used by developers directly.
@ -130,7 +132,8 @@ func contextDone(ctx context.Context) bool {
} }
// Upload starts the process of a resumable upload with a cancellable context. // Upload starts the process of a resumable upload with a cancellable context.
// It retries indefinitely (using exponential backoff) until cancelled. // It retries using the provided back off strategy until cancelled or the
// strategy indicates to stop retrying.
// It is called from the auto-generated API code and is not visible to the user. // It is called from the auto-generated API code and is not visible to the user.
// rx is private to the auto-generated API code. // rx is private to the auto-generated API code.
// Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close. // Exactly one of resp or err will be nil. If resp is non-nil, the caller must call resp.Body.Close.
@ -153,6 +156,33 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
} }
resp, err = rx.transferChunk(ctx) resp, err = rx.transferChunk(ctx)
var status int
if resp != nil {
status = resp.StatusCode
}
// Check if we should retry the request.
if shouldRetry(status, err) {
var retry bool
pause, retry = backoff.Pause()
if retry {
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
continue
}
}
// If the chunk was uploaded successfully, but there's still
// more to go, upload the next chunk without any delay.
if status == statusResumeIncomplete {
pause = 0
backoff.Reset()
resp.Body.Close()
continue
}
// It's possible for err and resp to both be non-nil here, but we expose a simpler // It's possible for err and resp to both be non-nil here, but we expose a simpler
// contract to our callers: exactly one of resp and err will be non-nil. This means // contract to our callers: exactly one of resp and err will be non-nil. This means
// that any response body must be closed here before returning a non-nil error. // that any response body must be closed here before returning a non-nil error.
@ -162,16 +192,7 @@ func (rx *ResumableUpload) Upload(ctx context.Context) (resp *http.Response, err
} }
return nil, err return nil, err
} }
if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusOK {
return resp, nil
}
resp.Body.Close()
if resp.StatusCode == statusResumeIncomplete { return resp, nil
pause = 0
backoff.Reset()
} else {
pause = backoff.Pause()
}
} }
} }

77
vendor/google.golang.org/api/gensupport/retry.go generated vendored Normal file
View File

@ -0,0 +1,77 @@
package gensupport
import (
"io"
"net"
"net/http"
"time"
"golang.org/x/net/context"
)
// Retry invokes the given function, retrying it multiple times if the connection failed or
// the HTTP status response indicates the request should be attempted again. ctx may be nil.
func Retry(ctx context.Context, f func() (*http.Response, error), backoff BackoffStrategy) (*http.Response, error) {
for {
resp, err := f()
var status int
if resp != nil {
status = resp.StatusCode
}
// Return if we shouldn't retry.
pause, retry := backoff.Pause()
if !shouldRetry(status, err) || !retry {
return resp, err
}
// Ensure the response body is closed, if any.
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
// Pause, but still listen to ctx.Done if context is not nil.
var done <-chan struct{}
if ctx != nil {
done = ctx.Done()
}
select {
case <-done:
return nil, ctx.Err()
case <-time.After(pause):
}
}
}
// DefaultBackoffStrategy returns a default strategy to use for retrying failed upload requests.
func DefaultBackoffStrategy() BackoffStrategy {
return &ExponentialBackoff{
Base: 250 * time.Millisecond,
Max: 16 * time.Second,
}
}
// shouldRetry returns true if the HTTP response / error indicates that the
// request should be attempted again.
func shouldRetry(status int, err error) bool {
// Retry for 5xx response codes.
if 500 <= status && status < 600 {
return true
}
// Retry on statusTooManyRequests{
if status == statusTooManyRequests {
return true
}
// Retry on unexpected EOFs and temporary network errors.
if err == io.ErrUnexpectedEOF {
return true
}
if err, ok := err.(net.Error); ok {
return err.Temporary()
}
return false
}

View File

@ -220,9 +220,13 @@ type contentTypeOption string
func (ct contentTypeOption) setOptions(o *MediaOptions) { func (ct contentTypeOption) setOptions(o *MediaOptions) {
o.ContentType = string(ct) o.ContentType = string(ct)
if o.ContentType == "" {
o.ForceEmptyContentType = true
}
} }
// ContentType returns a MediaOption which sets the content type of data to be uploaded. // ContentType returns a MediaOption which sets the Content-Type header for media uploads.
// If ctype is empty, the Content-Type header will be omitted.
func ContentType(ctype string) MediaOption { func ContentType(ctype string) MediaOption {
return contentTypeOption(ctype) return contentTypeOption(ctype)
} }
@ -248,8 +252,10 @@ func ChunkSize(size int) MediaOption {
// MediaOptions stores options for customizing media upload. It is not used by developers directly. // MediaOptions stores options for customizing media upload. It is not used by developers directly.
type MediaOptions struct { type MediaOptions struct {
ContentType string ContentType string
ChunkSize int ForceEmptyContentType bool
ChunkSize int
} }
// ProcessMediaOptions stores options from opts in a MediaOptions. // ProcessMediaOptions stores options from opts in a MediaOptions.

View File

@ -2,26 +2,15 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// Package uritemplates is a level 4 implementation of RFC 6570 (URI // Package uritemplates is a level 3 implementation of RFC 6570 (URI
// Template, http://tools.ietf.org/html/rfc6570). // Template, http://tools.ietf.org/html/rfc6570).
// // uritemplates does not support composite values (in Go: slices or maps)
// To use uritemplates, parse a template string and expand it with a value // and so does not qualify as a level 4 implementation.
// map:
//
// template, _ := uritemplates.Parse("https://api.github.com/repos{/user,repo}")
// values := make(map[string]interface{})
// values["user"] = "jtacoma"
// values["repo"] = "uritemplates"
// expanded, _ := template.ExpandString(values)
// fmt.Printf(expanded)
//
package uritemplates package uritemplates
import ( import (
"bytes" "bytes"
"errors" "errors"
"fmt"
"reflect"
"regexp" "regexp"
"strconv" "strconv"
"strings" "strings"
@ -45,52 +34,47 @@ func pctEncode(src []byte) []byte {
return dst return dst
} }
func escape(s string, allowReserved bool) (escaped string) { func escape(s string, allowReserved bool) string {
if allowReserved { if allowReserved {
escaped = string(reserved.ReplaceAllFunc([]byte(s), pctEncode)) return string(reserved.ReplaceAllFunc([]byte(s), pctEncode))
} else {
escaped = string(unreserved.ReplaceAllFunc([]byte(s), pctEncode))
} }
return escaped return string(unreserved.ReplaceAllFunc([]byte(s), pctEncode))
} }
// A UriTemplate is a parsed representation of a URI template. // A uriTemplate is a parsed representation of a URI template.
type UriTemplate struct { type uriTemplate struct {
raw string raw string
parts []templatePart parts []templatePart
} }
// Parse parses a URI template string into a UriTemplate object. // parse parses a URI template string into a uriTemplate object.
func Parse(rawtemplate string) (template *UriTemplate, err error) { func parse(rawTemplate string) (*uriTemplate, error) {
template = new(UriTemplate) split := strings.Split(rawTemplate, "{")
template.raw = rawtemplate parts := make([]templatePart, len(split)*2-1)
split := strings.Split(rawtemplate, "{")
template.parts = make([]templatePart, len(split)*2-1)
for i, s := range split { for i, s := range split {
if i == 0 { if i == 0 {
if strings.Contains(s, "}") { if strings.Contains(s, "}") {
err = errors.New("unexpected }") return nil, errors.New("unexpected }")
break
} }
template.parts[i].raw = s parts[i].raw = s
} else { continue
subsplit := strings.Split(s, "}")
if len(subsplit) != 2 {
err = errors.New("malformed template")
break
}
expression := subsplit[0]
template.parts[i*2-1], err = parseExpression(expression)
if err != nil {
break
}
template.parts[i*2].raw = subsplit[1]
} }
subsplit := strings.Split(s, "}")
if len(subsplit) != 2 {
return nil, errors.New("malformed template")
}
expression := subsplit[0]
var err error
parts[i*2-1], err = parseExpression(expression)
if err != nil {
return nil, err
}
parts[i*2].raw = subsplit[1]
} }
if err != nil { return &uriTemplate{
template = nil raw: rawTemplate,
} parts: parts,
return template, err }, nil
} }
type templatePart struct { type templatePart struct {
@ -160,6 +144,8 @@ func parseExpression(expression string) (result templatePart, err error) {
} }
func parseTerm(term string) (result templateTerm, err error) { func parseTerm(term string) (result templateTerm, err error) {
// TODO(djd): Remove "*" suffix parsing once we check that no APIs have
// mistakenly used that attribute.
if strings.HasSuffix(term, "*") { if strings.HasSuffix(term, "*") {
result.explode = true result.explode = true
term = term[:len(term)-1] term = term[:len(term)-1]
@ -185,175 +171,50 @@ func parseTerm(term string) (result templateTerm, err error) {
} }
// Expand expands a URI template with a set of values to produce a string. // Expand expands a URI template with a set of values to produce a string.
func (self *UriTemplate) Expand(value interface{}) (string, error) { func (t *uriTemplate) Expand(values map[string]string) string {
values, ismap := value.(map[string]interface{})
if !ismap {
if m, ismap := struct2map(value); !ismap {
return "", errors.New("expected map[string]interface{}, struct, or pointer to struct.")
} else {
return self.Expand(m)
}
}
var buf bytes.Buffer var buf bytes.Buffer
for _, p := range self.parts { for _, p := range t.parts {
err := p.expand(&buf, values) p.expand(&buf, values)
if err != nil {
return "", err
}
} }
return buf.String(), nil return buf.String()
} }
func (self *templatePart) expand(buf *bytes.Buffer, values map[string]interface{}) error { func (tp *templatePart) expand(buf *bytes.Buffer, values map[string]string) {
if len(self.raw) > 0 { if len(tp.raw) > 0 {
buf.WriteString(self.raw) buf.WriteString(tp.raw)
return nil return
} }
var zeroLen = buf.Len() var first = true
buf.WriteString(self.first) for _, term := range tp.terms {
var firstLen = buf.Len()
for _, term := range self.terms {
value, exists := values[term.name] value, exists := values[term.name]
if !exists { if !exists {
continue continue
} }
if buf.Len() != firstLen { if first {
buf.WriteString(self.sep) buf.WriteString(tp.first)
} first = false
switch v := value.(type) { } else {
case string: buf.WriteString(tp.sep)
self.expandString(buf, term, v)
case []interface{}:
self.expandArray(buf, term, v)
case map[string]interface{}:
if term.truncate > 0 {
return errors.New("cannot truncate a map expansion")
}
self.expandMap(buf, term, v)
default:
if m, ismap := struct2map(value); ismap {
if term.truncate > 0 {
return errors.New("cannot truncate a map expansion")
}
self.expandMap(buf, term, m)
} else {
str := fmt.Sprintf("%v", value)
self.expandString(buf, term, str)
}
} }
tp.expandString(buf, term, value)
} }
if buf.Len() == firstLen {
original := buf.Bytes()[:zeroLen]
buf.Reset()
buf.Write(original)
}
return nil
} }
func (self *templatePart) expandName(buf *bytes.Buffer, name string, empty bool) { func (tp *templatePart) expandName(buf *bytes.Buffer, name string, empty bool) {
if self.named { if tp.named {
buf.WriteString(name) buf.WriteString(name)
if empty { if empty {
buf.WriteString(self.ifemp) buf.WriteString(tp.ifemp)
} else { } else {
buf.WriteString("=") buf.WriteString("=")
} }
} }
} }
func (self *templatePart) expandString(buf *bytes.Buffer, t templateTerm, s string) { func (tp *templatePart) expandString(buf *bytes.Buffer, t templateTerm, s string) {
if len(s) > t.truncate && t.truncate > 0 { if len(s) > t.truncate && t.truncate > 0 {
s = s[:t.truncate] s = s[:t.truncate]
} }
self.expandName(buf, t.name, len(s) == 0) tp.expandName(buf, t.name, len(s) == 0)
buf.WriteString(escape(s, self.allowReserved)) buf.WriteString(escape(s, tp.allowReserved))
}
func (self *templatePart) expandArray(buf *bytes.Buffer, t templateTerm, a []interface{}) {
if len(a) == 0 {
return
} else if !t.explode {
self.expandName(buf, t.name, false)
}
for i, value := range a {
if t.explode && i > 0 {
buf.WriteString(self.sep)
} else if i > 0 {
buf.WriteString(",")
}
var s string
switch v := value.(type) {
case string:
s = v
default:
s = fmt.Sprintf("%v", v)
}
if len(s) > t.truncate && t.truncate > 0 {
s = s[:t.truncate]
}
if self.named && t.explode {
self.expandName(buf, t.name, len(s) == 0)
}
buf.WriteString(escape(s, self.allowReserved))
}
}
func (self *templatePart) expandMap(buf *bytes.Buffer, t templateTerm, m map[string]interface{}) {
if len(m) == 0 {
return
}
if !t.explode {
self.expandName(buf, t.name, len(m) == 0)
}
var firstLen = buf.Len()
for k, value := range m {
if firstLen != buf.Len() {
if t.explode {
buf.WriteString(self.sep)
} else {
buf.WriteString(",")
}
}
var s string
switch v := value.(type) {
case string:
s = v
default:
s = fmt.Sprintf("%v", v)
}
if t.explode {
buf.WriteString(escape(k, self.allowReserved))
buf.WriteRune('=')
buf.WriteString(escape(s, self.allowReserved))
} else {
buf.WriteString(escape(k, self.allowReserved))
buf.WriteRune(',')
buf.WriteString(escape(s, self.allowReserved))
}
}
}
func struct2map(v interface{}) (map[string]interface{}, bool) {
value := reflect.ValueOf(v)
switch value.Type().Kind() {
case reflect.Ptr:
return struct2map(value.Elem().Interface())
case reflect.Struct:
m := make(map[string]interface{})
for i := 0; i < value.NumField(); i++ {
tag := value.Type().Field(i).Tag
var name string
if strings.Contains(string(tag), ":") {
name = tag.Get("uri")
} else {
name = strings.TrimSpace(string(tag))
}
if len(name) == 0 {
name = value.Type().Field(i).Name
}
m[name] = value.Field(i).Interface()
}
return m, true
}
return nil, false
} }

View File

@ -1,13 +1,13 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uritemplates package uritemplates
func Expand(path string, expansions map[string]string) (string, error) { func Expand(path string, values map[string]string) (string, error) {
template, err := Parse(path) template, err := parse(path)
if err != nil { if err != nil {
return "", err return "", err
} }
values := make(map[string]interface{}) return template.Expand(values), nil
for k, v := range expansions {
values[k] = v
}
return template.Expand(values)
} }

View File

@ -1,12 +1,12 @@
{ {
"kind": "discovery#restDescription", "kind": "discovery#restDescription",
"etag": "\"ye6orv2F-1npMW3u9suM3a7C5Bo/CCmkz9wJbxqIZMDlSyPUsI6BFWQ\"", "etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/OLx7eYKI1NQCi-ys96oQ7ZJUHE8\"",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"id": "sqladmin:v1beta4", "id": "sqladmin:v1beta4",
"name": "sqladmin", "name": "sqladmin",
"canonicalName": "SQL Admin", "canonicalName": "SQL Admin",
"version": "v1beta4", "version": "v1beta4",
"revision": "20151117", "revision": "20160222",
"title": "Cloud SQL Administration API", "title": "Cloud SQL Administration API",
"description": "API for Cloud SQL database instance management.", "description": "API for Cloud SQL database instance management.",
"ownerDomain": "google.com", "ownerDomain": "google.com",
@ -321,14 +321,18 @@
"type": "object", "type": "object",
"description": "A Cloud SQL instance resource.", "description": "A Cloud SQL instance resource.",
"properties": { "properties": {
"backendType": {
"type": "string",
"description": "FIRST_GEN: Basic Cloud SQL instance that runs in a Google-managed container.\nSECOND_GEN: A newer Cloud SQL backend that runs in a Compute Engine VM.\nEXTERNAL: A MySQL server that is not managed by Google."
},
"currentDiskSize": { "currentDiskSize": {
"type": "string", "type": "string",
"description": "The current disk usage of the instance in bytes.", "description": "The current disk usage of the instance in bytes. This property has been deprecated. Users should use the \"cloudsql.googleapis.com/database/disk/bytes_used\" metric in Cloud Monitoring API instead. Please see https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ for details.",
"format": "int64" "format": "int64"
}, },
"databaseVersion": { "databaseVersion": {
"type": "string", "type": "string",
"description": "The database engine type and version. Can be MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_5. The databaseVersion can not be changed after instance creation." "description": "The database engine type and version. Can be MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_6. The databaseVersion can not be changed after instance creation."
}, },
"etag": { "etag": {
"type": "string", "type": "string",
@ -336,13 +340,15 @@
}, },
"failoverReplica": { "failoverReplica": {
"type": "object", "type": "object",
"description": "The name and status of the failover replica. Only applies to Second Generation instances.", "description": "The name and status of the failover replica. This property is applicable only to Second Generation instances.",
"properties": { "properties": {
"available": { "available": {
"type": "boolean" "type": "boolean",
"description": "The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The master can only failover to the falover replica when the status is true."
}, },
"name": { "name": {
"type": "string" "type": "string",
"description": "The name of the failover replica."
} }
} }
}, },
@ -359,7 +365,7 @@
}, },
"ipv6Address": { "ipv6Address": {
"type": "string", "type": "string",
"description": "The IPv6 address assigned to the instance." "description": "The IPv6 address assigned to the instance. This property is applicable only to First Generation instances."
}, },
"kind": { "kind": {
"type": "string", "type": "string",
@ -394,7 +400,7 @@
}, },
"region": { "region": {
"type": "string", "type": "string",
"description": "The geographical region. Can be us-central, asia-east1 or europe-west1. Defaults to us-central. The region can not be changed after instance creation." "description": "The geographical region. Can be us-central (FIRST_GEN instances only), us-central1 (SECOND_GEN instances only), asia-east1 or europe-west1. Defaults to us-central or us-central1 depending on the instance type (First Generation or Second Generation). The region can not be changed after instance creation."
}, },
"replicaConfiguration": { "replicaConfiguration": {
"$ref": "ReplicaConfiguration", "$ref": "ReplicaConfiguration",
@ -417,7 +423,7 @@
}, },
"serviceAccountEmailAddress": { "serviceAccountEmailAddress": {
"type": "string", "type": "string",
"description": "The service account email address assigned to the instance." "description": "The service account email address assigned to the instance. This property is applicable only to Second Generation instances."
}, },
"settings": { "settings": {
"$ref": "Settings", "$ref": "Settings",
@ -432,6 +438,13 @@
"state": { "state": {
"type": "string", "type": "string",
"description": "The current serving state of the Cloud SQL instance. This can be one of the following.\nRUNNABLE: The instance is running, or is ready to run when accessed.\nSUSPENDED: The instance is not available, for example due to problems with billing.\nPENDING_CREATE: The instance is being created.\nMAINTENANCE: The instance is down for maintenance.\nFAILED: The instance creation failed.\nUNKNOWN_STATE: The state of the instance is unknown." "description": "The current serving state of the Cloud SQL instance. This can be one of the following.\nRUNNABLE: The instance is running, or is ready to run when accessed.\nSUSPENDED: The instance is not available, for example due to problems with billing.\nPENDING_CREATE: The instance is being created.\nMAINTENANCE: The instance is down for maintenance.\nFAILED: The instance creation failed.\nUNKNOWN_STATE: The state of the instance is unknown."
},
"suspensionReason": {
"type": "array",
"description": "If the instance state is SUSPENDED, the reason for the suspension.",
"items": {
"type": "string"
}
} }
} }
}, },
@ -1050,11 +1063,11 @@
"properties": { "properties": {
"activationPolicy": { "activationPolicy": {
"type": "string", "type": "string",
"description": "The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.\nALWAYS: The instance should always be active.\nNEVER: The instance should never be activated.\nON_DEMAND: The instance is activated upon receiving requests." "description": "The activation policy for this instance. This specifies when the instance should be activated and is applicable only when the instance state is RUNNABLE. This can be one of the following.\nALWAYS: The instance should always be active.\nNEVER: The instance should never be activated.\nON_DEMAND: The instance is activated upon receiving requests; only applicable to First Generation instances."
}, },
"authorizedGaeApplications": { "authorizedGaeApplications": {
"type": "array", "type": "array",
"description": "The App Engine app IDs that can access this instance.", "description": "The App Engine app IDs that can access this instance. This property is only applicable to First Generation instances.",
"items": { "items": {
"type": "string" "type": "string"
} }
@ -1065,16 +1078,16 @@
}, },
"crashSafeReplicationEnabled": { "crashSafeReplicationEnabled": {
"type": "boolean", "type": "boolean",
"description": "Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled." "description": "Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. This property is only applicable to First Generation instances."
}, },
"dataDiskSizeGb": { "dataDiskSizeGb": {
"type": "string", "type": "string",
"description": "The size of data disk, in GB. Only supported for 2nd Generation instances. The data disk size minimum is 10GB.", "description": "The size of data disk, in GB. The data disk size minimum is 10GB. This property is only applicable to Second Generation instances.",
"format": "int64" "format": "int64"
}, },
"dataDiskType": { "dataDiskType": {
"type": "string", "type": "string",
"description": "The type of data disk. Only supported for 2nd Generation instances. The default type is SSD." "description": "The type of data disk. Only supported for Second Generation instances. The default type is PD_SSD. This property is only applicable to Second Generation instances."
}, },
"databaseFlags": { "databaseFlags": {
"type": "array", "type": "array",
@ -1089,7 +1102,7 @@
}, },
"ipConfiguration": { "ipConfiguration": {
"$ref": "IpConfiguration", "$ref": "IpConfiguration",
"description": "The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance." "description": "The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled for Second Generation instances."
}, },
"kind": { "kind": {
"type": "string", "type": "string",
@ -1098,19 +1111,19 @@
}, },
"locationPreference": { "locationPreference": {
"$ref": "LocationPreference", "$ref": "LocationPreference",
"description": "The location preference settings. This allows the instance to be located as near as possible to either an App Engine app or GCE zone for better performance." "description": "The location preference settings. This allows the instance to be located as near as possible to either an App Engine app or GCE zone for better performance. App Engine co-location is only applicable to First Generation instances."
}, },
"maintenanceWindow": { "maintenanceWindow": {
"$ref": "MaintenanceWindow", "$ref": "MaintenanceWindow",
"description": "The maintenance window for this instance. This specifies when the instance may be restarted for maintenance purposes." "description": "The maintenance window for this instance. This specifies when the instance may be restarted for maintenance purposes. This property is only applicable to Second Generation instances."
}, },
"pricingPlan": { "pricingPlan": {
"type": "string", "type": "string",
"description": "The pricing plan for this instance. This can be either PER_USE or PACKAGE." "description": "The pricing plan for this instance. This can be either PER_USE or PACKAGE. Only PER_USE is supported for Second Generation instances."
}, },
"replicationType": { "replicationType": {
"type": "string", "type": "string",
"description": "The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS." "description": "The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS. This property is only applicable to First Generation instances."
}, },
"settingsVersion": { "settingsVersion": {
"type": "string", "type": "string",
@ -1319,7 +1332,7 @@
}, },
"host": { "host": {
"type": "string", "type": "string",
"description": "The host name from which the user can connect. For insert operations, host defaults to an empty string. For update operations, host is specified as part of the request URL. The host name is not mutable with this API." "description": "The host name from which the user can connect. For insert operations, host defaults to an empty string. For update operations, host is specified as part of the request URL. The host name cannot be updated after insertion."
}, },
"instance": { "instance": {
"type": "string", "type": "string",
@ -1499,7 +1512,7 @@
"id": "sql.databases.delete", "id": "sql.databases.delete",
"path": "projects/{project}/instances/{instance}/databases/{database}", "path": "projects/{project}/instances/{instance}/databases/{database}",
"httpMethod": "DELETE", "httpMethod": "DELETE",
"description": "Deletes a resource containing information about a database inside a Cloud SQL instance.", "description": "Deletes a database from a Cloud SQL instance.",
"parameters": { "parameters": {
"database": { "database": {
"type": "string", "type": "string",
@ -1743,7 +1756,7 @@
"id": "sql.instances.clone", "id": "sql.instances.clone",
"path": "projects/{project}/instances/{instance}/clone", "path": "projects/{project}/instances/{instance}/clone",
"httpMethod": "POST", "httpMethod": "POST",
"description": "Creates a Cloud SQL instance as a clone of the source instance.", "description": "Creates a Cloud SQL instance as a clone of the source instance. The API is not ready for Second Generation instances yet.",
"parameters": { "parameters": {
"instance": { "instance": {
"type": "string", "type": "string",

View File

@ -459,19 +459,31 @@ func (s *DatabaseFlags) MarshalJSON() ([]byte, error) {
// DatabaseInstance: A Cloud SQL instance resource. // DatabaseInstance: A Cloud SQL instance resource.
type DatabaseInstance struct { type DatabaseInstance struct {
// BackendType: FIRST_GEN: Basic Cloud SQL instance that runs in a
// Google-managed container.
// SECOND_GEN: A newer Cloud SQL backend that runs in a Compute Engine
// VM.
// EXTERNAL: A MySQL server that is not managed by Google.
BackendType string `json:"backendType,omitempty"`
// CurrentDiskSize: The current disk usage of the instance in bytes. // CurrentDiskSize: The current disk usage of the instance in bytes.
// This property has been deprecated. Users should use the
// "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud
// Monitoring API instead. Please see
// https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ for
// details.
CurrentDiskSize int64 `json:"currentDiskSize,omitempty,string"` CurrentDiskSize int64 `json:"currentDiskSize,omitempty,string"`
// DatabaseVersion: The database engine type and version. Can be // DatabaseVersion: The database engine type and version. Can be
// MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_5. The databaseVersion // MYSQL_5_5 or MYSQL_5_6. Defaults to MYSQL_5_6. The databaseVersion
// can not be changed after instance creation. // can not be changed after instance creation.
DatabaseVersion string `json:"databaseVersion,omitempty"` DatabaseVersion string `json:"databaseVersion,omitempty"`
// Etag: HTTP 1.1 Entity tag for the resource. // Etag: HTTP 1.1 Entity tag for the resource.
Etag string `json:"etag,omitempty"` Etag string `json:"etag,omitempty"`
// FailoverReplica: The name and status of the failover replica. Only // FailoverReplica: The name and status of the failover replica. This
// applies to Second Generation instances. // property is applicable only to Second Generation instances.
FailoverReplica *DatabaseInstanceFailoverReplica `json:"failoverReplica,omitempty"` FailoverReplica *DatabaseInstanceFailoverReplica `json:"failoverReplica,omitempty"`
// InstanceType: The instance type. This can be one of the // InstanceType: The instance type. This can be one of the
@ -487,7 +499,8 @@ type DatabaseInstance struct {
// IpAddresses: The assigned IP addresses for the instance. // IpAddresses: The assigned IP addresses for the instance.
IpAddresses []*IpMapping `json:"ipAddresses,omitempty"` IpAddresses []*IpMapping `json:"ipAddresses,omitempty"`
// Ipv6Address: The IPv6 address assigned to the instance. // Ipv6Address: The IPv6 address assigned to the instance. This property
// is applicable only to First Generation instances.
Ipv6Address string `json:"ipv6Address,omitempty"` Ipv6Address string `json:"ipv6Address,omitempty"`
// Kind: This is always sql#instance. // Kind: This is always sql#instance.
@ -512,9 +525,11 @@ type DatabaseInstance struct {
// instance. The Google apps domain is prefixed if applicable. // instance. The Google apps domain is prefixed if applicable.
Project string `json:"project,omitempty"` Project string `json:"project,omitempty"`
// Region: The geographical region. Can be us-central, asia-east1 or // Region: The geographical region. Can be us-central (FIRST_GEN
// europe-west1. Defaults to us-central. The region can not be changed // instances only), us-central1 (SECOND_GEN instances only), asia-east1
// after instance creation. // or europe-west1. Defaults to us-central or us-central1 depending on
// the instance type (First Generation or Second Generation). The region
// can not be changed after instance creation.
Region string `json:"region,omitempty"` Region string `json:"region,omitempty"`
// ReplicaConfiguration: Configuration specific to read-replicas // ReplicaConfiguration: Configuration specific to read-replicas
@ -531,7 +546,8 @@ type DatabaseInstance struct {
ServerCaCert *SslCert `json:"serverCaCert,omitempty"` ServerCaCert *SslCert `json:"serverCaCert,omitempty"`
// ServiceAccountEmailAddress: The service account email address // ServiceAccountEmailAddress: The service account email address
// assigned to the instance. // assigned to the instance. This property is applicable only to Second
// Generation instances.
ServiceAccountEmailAddress string `json:"serviceAccountEmailAddress,omitempty"` ServiceAccountEmailAddress string `json:"serviceAccountEmailAddress,omitempty"`
// Settings: The user settings. // Settings: The user settings.
@ -549,11 +565,15 @@ type DatabaseInstance struct {
// UNKNOWN_STATE: The state of the instance is unknown. // UNKNOWN_STATE: The state of the instance is unknown.
State string `json:"state,omitempty"` State string `json:"state,omitempty"`
// SuspensionReason: If the instance state is SUSPENDED, the reason for
// the suspension.
SuspensionReason []string `json:"suspensionReason,omitempty"`
// ServerResponse contains the HTTP response code and headers from the // ServerResponse contains the HTTP response code and headers from the
// server. // server.
googleapi.ServerResponse `json:"-"` googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CurrentDiskSize") to // ForceSendFields is a list of field names (e.g. "BackendType") to
// unconditionally include in API requests. By default, fields with // unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer, // empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the // non-interface field appearing in ForceSendFields will be sent to the
@ -569,10 +589,15 @@ func (s *DatabaseInstance) MarshalJSON() ([]byte, error) {
} }
// DatabaseInstanceFailoverReplica: The name and status of the failover // DatabaseInstanceFailoverReplica: The name and status of the failover
// replica. Only applies to Second Generation instances. // replica. This property is applicable only to Second Generation
// instances.
type DatabaseInstanceFailoverReplica struct { type DatabaseInstanceFailoverReplica struct {
// Available: The availability status of the failover replica. A false
// status indicates that the failover replica is out of sync. The master
// can only failover to the falover replica when the status is true.
Available bool `json:"available,omitempty"` Available bool `json:"available,omitempty"`
// Name: The name of the failover replica.
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
// ForceSendFields is a list of field names (e.g. "Available") to // ForceSendFields is a list of field names (e.g. "Available") to
@ -1443,11 +1468,13 @@ type Settings struct {
// following. // following.
// ALWAYS: The instance should always be active. // ALWAYS: The instance should always be active.
// NEVER: The instance should never be activated. // NEVER: The instance should never be activated.
// ON_DEMAND: The instance is activated upon receiving requests. // ON_DEMAND: The instance is activated upon receiving requests; only
// applicable to First Generation instances.
ActivationPolicy string `json:"activationPolicy,omitempty"` ActivationPolicy string `json:"activationPolicy,omitempty"`
// AuthorizedGaeApplications: The App Engine app IDs that can access // AuthorizedGaeApplications: The App Engine app IDs that can access
// this instance. // this instance. This property is only applicable to First Generation
// instances.
AuthorizedGaeApplications []string `json:"authorizedGaeApplications,omitempty"` AuthorizedGaeApplications []string `json:"authorizedGaeApplications,omitempty"`
// BackupConfiguration: The daily backup configuration for the instance. // BackupConfiguration: The daily backup configuration for the instance.
@ -1455,15 +1482,18 @@ type Settings struct {
// CrashSafeReplicationEnabled: Configuration specific to read replica // CrashSafeReplicationEnabled: Configuration specific to read replica
// instances. Indicates whether database flags for crash-safe // instances. Indicates whether database flags for crash-safe
// replication are enabled. // replication are enabled. This property is only applicable to First
// Generation instances.
CrashSafeReplicationEnabled bool `json:"crashSafeReplicationEnabled,omitempty"` CrashSafeReplicationEnabled bool `json:"crashSafeReplicationEnabled,omitempty"`
// DataDiskSizeGb: The size of data disk, in GB. Only supported for 2nd // DataDiskSizeGb: The size of data disk, in GB. The data disk size
// Generation instances. The data disk size minimum is 10GB. // minimum is 10GB. This property is only applicable to Second
// Generation instances.
DataDiskSizeGb int64 `json:"dataDiskSizeGb,omitempty,string"` DataDiskSizeGb int64 `json:"dataDiskSizeGb,omitempty,string"`
// DataDiskType: The type of data disk. Only supported for 2nd // DataDiskType: The type of data disk. Only supported for Second
// Generation instances. The default type is SSD. // Generation instances. The default type is PD_SSD. This property is
// only applicable to Second Generation instances.
DataDiskType string `json:"dataDiskType,omitempty"` DataDiskType string `json:"dataDiskType,omitempty"`
// DatabaseFlags: The database flags passed to the instance at startup. // DatabaseFlags: The database flags passed to the instance at startup.
@ -1475,7 +1505,8 @@ type Settings struct {
// IpConfiguration: The settings for IP Management. This allows to // IpConfiguration: The settings for IP Management. This allows to
// enable or disable the instance IP and manage which external networks // enable or disable the instance IP and manage which external networks
// can connect to the instance. // can connect to the instance. The IPv4 address cannot be disabled for
// Second Generation instances.
IpConfiguration *IpConfiguration `json:"ipConfiguration,omitempty"` IpConfiguration *IpConfiguration `json:"ipConfiguration,omitempty"`
// Kind: This is always sql#settings. // Kind: This is always sql#settings.
@ -1483,20 +1514,24 @@ type Settings struct {
// LocationPreference: The location preference settings. This allows the // LocationPreference: The location preference settings. This allows the
// instance to be located as near as possible to either an App Engine // instance to be located as near as possible to either an App Engine
// app or GCE zone for better performance. // app or GCE zone for better performance. App Engine co-location is
// only applicable to First Generation instances.
LocationPreference *LocationPreference `json:"locationPreference,omitempty"` LocationPreference *LocationPreference `json:"locationPreference,omitempty"`
// MaintenanceWindow: The maintenance window for this instance. This // MaintenanceWindow: The maintenance window for this instance. This
// specifies when the instance may be restarted for maintenance // specifies when the instance may be restarted for maintenance
// purposes. // purposes. This property is only applicable to Second Generation
// instances.
MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
// PricingPlan: The pricing plan for this instance. This can be either // PricingPlan: The pricing plan for this instance. This can be either
// PER_USE or PACKAGE. // PER_USE or PACKAGE. Only PER_USE is supported for Second Generation
// instances.
PricingPlan string `json:"pricingPlan,omitempty"` PricingPlan string `json:"pricingPlan,omitempty"`
// ReplicationType: The type of replication this instance uses. This can // ReplicationType: The type of replication this instance uses. This can
// be either ASYNCHRONOUS or SYNCHRONOUS. // be either ASYNCHRONOUS or SYNCHRONOUS. This property is only
// applicable to First Generation instances.
ReplicationType string `json:"replicationType,omitempty"` ReplicationType string `json:"replicationType,omitempty"`
// SettingsVersion: The version of instance settings. This is a required // SettingsVersion: The version of instance settings. This is a required
@ -1770,8 +1805,8 @@ type User struct {
// Host: The host name from which the user can connect. For insert // Host: The host name from which the user can connect. For insert
// operations, host defaults to an empty string. For update operations, // operations, host defaults to an empty string. For update operations,
// host is specified as part of the request URL. The host name is not // host is specified as part of the request URL. The host name cannot be
// mutable with this API. // updated after insertion.
Host string `json:"host,omitempty"` Host string `json:"host,omitempty"`
// Instance: The name of the Cloud SQL instance. This does not include // Instance: The name of the Cloud SQL instance. This does not include
@ -2314,8 +2349,7 @@ type DatabasesDeleteCall struct {
ctx_ context.Context ctx_ context.Context
} }
// Delete: Deletes a resource containing information about a database // Delete: Deletes a database from a Cloud SQL instance.
// inside a Cloud SQL instance.
func (r *DatabasesService) Delete(project string, instance string, database string) *DatabasesDeleteCall { func (r *DatabasesService) Delete(project string, instance string, database string) *DatabasesDeleteCall {
c := &DatabasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} c := &DatabasesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project c.project = project
@ -2395,7 +2429,7 @@ func (c *DatabasesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, erro
} }
return ret, nil return ret, nil
// { // {
// "description": "Deletes a resource containing information about a database inside a Cloud SQL instance.", // "description": "Deletes a database from a Cloud SQL instance.",
// "httpMethod": "DELETE", // "httpMethod": "DELETE",
// "id": "sql.databases.delete", // "id": "sql.databases.delete",
// "parameterOrder": [ // "parameterOrder": [
@ -3258,7 +3292,7 @@ type InstancesCloneCall struct {
} }
// Clone: Creates a Cloud SQL instance as a clone of the source // Clone: Creates a Cloud SQL instance as a clone of the source
// instance. // instance. The API is not ready for Second Generation instances yet.
func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall { func (r *InstancesService) Clone(project string, instance string, instancesclonerequest *InstancesCloneRequest) *InstancesCloneCall {
c := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)} c := &InstancesCloneCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project c.project = project
@ -3343,7 +3377,7 @@ func (c *InstancesCloneCall) Do(opts ...googleapi.CallOption) (*Operation, error
} }
return ret, nil return ret, nil
// { // {
// "description": "Creates a Cloud SQL instance as a clone of the source instance.", // "description": "Creates a Cloud SQL instance as a clone of the source instance. The API is not ready for Second Generation instances yet.",
// "httpMethod": "POST", // "httpMethod": "POST",
// "id": "sql.instances.clone", // "id": "sql.instances.clone",
// "parameterOrder": [ // "parameterOrder": [

View File

@ -1,13 +1,13 @@
{ {
"kind": "discovery#restDescription", "kind": "discovery#restDescription",
"etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/obxe7w0FjJgGPQFNs6hMClVbJfI\"", "etag": "\"bRFOOrZKfO9LweMbPqu0kcu6De8/KVPQfwGxQTBtH0g1kuij0C9i4uc\"",
"discoveryVersion": "v1", "discoveryVersion": "v1",
"id": "storage:v1", "id": "storage:v1",
"name": "storage", "name": "storage",
"version": "v1", "version": "v1",
"revision": "20160121", "revision": "20160304",
"title": "Cloud Storage JSON API", "title": "Cloud Storage JSON API",
"description": "Lets you store and retrieve potentially-large, immutable data objects.", "description": "Stores and retrieves potentially large, immutable data objects.",
"ownerDomain": "google.com", "ownerDomain": "google.com",
"ownerName": "Google", "ownerName": "Google",
"icons": { "icons": {

View File

@ -5993,18 +5993,29 @@ func (c *ObjectsInsertCall) Projection(projection string) *ObjectsInsertCall {
return c return c
} }
// Media specifies the media to upload in a single chunk. At most one of // Media specifies the media to upload in one or more chunks. The chunk
// Media and ResumableMedia may be set. // size may be controlled by supplying a MediaOption generated by
// googleapi.ChunkSize. The chunk size defaults to
// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
// upload request will be determined by sniffing the contents of r,
// unless a MediaOption generated by googleapi.ContentType is
// supplied.
// At most one of Media and ResumableMedia may be set.
func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall { func (c *ObjectsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *ObjectsInsertCall {
opts := googleapi.ProcessMediaOptions(options) opts := googleapi.ProcessMediaOptions(options)
chunkSize := opts.ChunkSize chunkSize := opts.ChunkSize
r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType) if !opts.ForceEmptyContentType {
r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
}
c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize) c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
return c return c
} }
// ResumableMedia specifies the media to upload in chunks and can be // ResumableMedia specifies the media to upload in chunks and can be
// canceled with ctx. ResumableMedia is deprecated in favour of Media. // canceled with ctx.
//
// Deprecated: use Media instead.
//
// At most one of Media and ResumableMedia may be set. mediaType // At most one of Media and ResumableMedia may be set. mediaType
// identifies the MIME media type of the upload, such as "image/png". If // identifies the MIME media type of the upload, such as "image/png". If
// mediaType is "", it will be auto-detected. The provided ctx will // mediaType is "", it will be auto-detected. The provided ctx will
@ -6074,7 +6085,7 @@ func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
googleapi.Expand(req.URL, map[string]string{ googleapi.Expand(req.URL, map[string]string{
"bucket": c.bucket, "bucket": c.bucket,
}) })
if c.resumableBuffer_ != nil { if c.resumableBuffer_ != nil && c.mediaType_ != "" {
req.Header.Set("X-Upload-Content-Type", c.mediaType_) req.Header.Set("X-Upload-Content-Type", c.mediaType_)
} }
req.Header.Set("Content-Type", ctype) req.Header.Set("Content-Type", ctype)
@ -6094,7 +6105,9 @@ func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
// was returned. // was returned.
func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) { func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
gensupport.SetOptions(c.urlParams_, opts...) gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json") res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
return c.doRequest("json")
}, gensupport.DefaultBackoffStrategy())
if res != nil && res.StatusCode == http.StatusNotModified { if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil { if res.Body != nil {
res.Body.Close() res.Body.Close()
@ -6134,6 +6147,9 @@ func (c *ObjectsInsertCall) Do(opts ...googleapi.CallOption) (*Object, error) {
return nil, err return nil, err
} }
defer res.Body.Close() defer res.Body.Close()
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
} }
ret := &Object{ ret := &Object{
ServerResponse: googleapi.ServerResponse{ ServerResponse: googleapi.ServerResponse{