Commit 43d2da04 authored by Minhan Xia's avatar Minhan Xia

godep revendor google api go clients

parent 4714cddc
......@@ -2861,55 +2861,55 @@
},
{
"ImportPath": "google.golang.org/api/cloudkms/v1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/cloudmonitoring/v2beta2",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/compute/v0.alpha",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/compute/v0.beta",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/compute/v1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/container/v1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/dns/v1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/gensupport",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/googleapi",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/googleapi/internal/uritemplates",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/logging/v2beta1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/monitoring/v3",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/api/pubsub/v1",
"Rev": "98825bb0065da4054e5da6db34f5fc598e50bc24"
"Rev": "654f863362977d69086620b5f72f13e911da2410"
},
{
"ImportPath": "google.golang.org/genproto/googleapis/rpc/status",
......
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
......@@ -16,6 +11,7 @@ go_library(
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)
filegroup(
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -850,28 +850,43 @@ func (s *HttpLoadBalancing) MarshalJSON() ([]byte, error) {
// IPAllocationPolicy: Configuration for controlling how IPs are
// allocated in the cluster.
type IPAllocationPolicy struct {
// ClusterIpv4Cidr: The IP address range for the cluster pod IPs. If
// this field is set, then
// ClusterIpv4Cidr: This field is deprecated, use
// cluster_ipv4_cidr_block.
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty"`
// ClusterIpv4CidrBlock: The IP address range for the cluster pod IPs.
// If this field is set, then
// `cluster.cluster_ipv4_cidr` must be left blank.
//
// This field is only applicable when `use_ip_aliases` is true.
//
// Set to blank to have a range will be chosen with the default
// size.
// Set to blank to have a range chosen with the default size.
//
// Set to /netmask (e.g. `/14`) to have a range be chosen with a
// Set to /netmask (e.g. `/14`) to have a range chosen with a
// specific
// netmask.
//
// Set to a
// Set to
// a
// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// no
// tation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
//
// notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
// (e.g.
// `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific
// range
// to use.
ClusterIpv4Cidr string `json:"clusterIpv4Cidr,omitempty"`
ClusterIpv4CidrBlock string `json:"clusterIpv4CidrBlock,omitempty"`
// ClusterSecondaryRangeName: The name of the secondary range to be used
// for the cluster CIDR
// block. The secondary range will be used for pod IP
// addresses. This must be an existing secondary range associated
// with the cluster subnetwork.
//
// This field is only applicable with use_ip_aliases is true
// and
// create_subnetwork is false.
ClusterSecondaryRangeName string `json:"clusterSecondaryRangeName,omitempty"`
// CreateSubnetwork: Whether a new subnetwork will be created
// automatically for the cluster.
......@@ -879,50 +894,68 @@ type IPAllocationPolicy struct {
// This field is only applicable when `use_ip_aliases` is true.
CreateSubnetwork bool `json:"createSubnetwork,omitempty"`
// NodeIpv4Cidr: The IP address range of the instance IPs in this
// NodeIpv4Cidr: This field is deprecated, use node_ipv4_cidr_block.
NodeIpv4Cidr string `json:"nodeIpv4Cidr,omitempty"`
// NodeIpv4CidrBlock: The IP address range of the instance IPs in this
// cluster.
//
// This is applicable only if `create_subnetwork` is true.
//
// Set to blank to have a range will be chosen with the default
// size.
// Set to blank to have a range chosen with the default size.
//
// Set to /netmask (e.g. `/14`) to have a range be chosen with a
// Set to /netmask (e.g. `/14`) to have a range chosen with a
// specific
// netmask.
//
// Set to a
// Set to
// a
// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// no
// tation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
//
// notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
// (e.g.
// `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific
// range
// to use.
NodeIpv4Cidr string `json:"nodeIpv4Cidr,omitempty"`
NodeIpv4CidrBlock string `json:"nodeIpv4CidrBlock,omitempty"`
// ServicesIpv4Cidr: This field is deprecated, use
// services_ipv4_cidr_block.
ServicesIpv4Cidr string `json:"servicesIpv4Cidr,omitempty"`
// ServicesIpv4Cidr: The IP address range of the services IPs in this
// cluster. If blank, a range
// ServicesIpv4CidrBlock: The IP address range of the services IPs in
// this cluster. If blank, a range
// will be automatically chosen with the default size.
//
// This field is only applicable when `use_ip_aliases` is true.
//
// Set to blank to have a range will be chosen with the default
// size.
// Set to blank to have a range chosen with the default size.
//
// Set to /netmask (e.g. `/14`) to have a range be chosen with a
// Set to /netmask (e.g. `/14`) to have a range chosen with a
// specific
// netmask.
//
// Set to a
// Set to
// a
// [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// no
// tation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
//
// notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks
// (e.g.
// `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific
// range
// to use.
ServicesIpv4Cidr string `json:"servicesIpv4Cidr,omitempty"`
ServicesIpv4CidrBlock string `json:"servicesIpv4CidrBlock,omitempty"`
// ServicesSecondaryRangeName: The name of the secondary range to be
// used as for the services
// CIDR block. The secondary range will be used for service
// ClusterIPs. This must be an existing secondary range associated
// with the cluster subnetwork.
//
// This field is only applicable with use_ip_aliases is true
// and
// create_subnetwork is false.
ServicesSecondaryRangeName string `json:"servicesSecondaryRangeName,omitempty"`
// SubnetworkName: A custom subnetwork name to be used if
// `create_subnetwork` is true. If
......@@ -1313,7 +1346,8 @@ type NodeConfig struct {
// and conflicts should be avoided.
// For more information, including usage and the valid values,
// see:
// http://kubernetes.io/v1.1/docs/user-guide/labels.html
// https://kubernetes.io/docs/concepts/overview/working-with-objects
// /labels/
Labels map[string]string `json:"labels,omitempty"`
// LocalSsdCount: The number of local SSD disks to be attached to the
......@@ -1627,6 +1661,11 @@ type Operation struct {
// Detail: Detailed operation progress, if available.
Detail string `json:"detail,omitempty"`
// EndTime: [Output only] The time the operation completed,
// in
// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
EndTime string `json:"endTime,omitempty"`
// Name: The server-assigned ID for the operation.
Name string `json:"name,omitempty"`
......@@ -1654,6 +1693,11 @@ type Operation struct {
// SelfLink: Server-defined URL for the resource.
SelfLink string `json:"selfLink,omitempty"`
// StartTime: [Output only] The time the operation started,
// in
// [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
StartTime string `json:"startTime,omitempty"`
// Status: The current status of the operation.
//
// Possible values:
......
......@@ -174,26 +174,126 @@ func typeHeader(contentType string) textproto.MIMEHeader {
// PrepareUpload determines whether the data in the supplied reader should be
// uploaded in a single request, or in sequential chunks.
// chunkSize is the size of the chunk that media should be split into.
// If chunkSize is non-zero and the contents of media do not fit in a single
// chunk (or there is an error reading media), then media will be returned as a
// MediaBuffer. Otherwise, media will be returned as a Reader.
//
// If chunkSize is zero, media is returned as the first value, and the other
// two return values are nil, true.
//
// Otherwise, a MediaBuffer is returned, along with a bool indicating whether the
// contents of media fit in a single chunk.
//
// After PrepareUpload has been called, media should no longer be used: the
// media content should be accessed via one of the return values.
func PrepareUpload(media io.Reader, chunkSize int) (io.Reader, *MediaBuffer) {
func PrepareUpload(media io.Reader, chunkSize int) (r io.Reader, mb *MediaBuffer, singleChunk bool) {
if chunkSize == 0 { // do not chunk
return media, nil
return media, nil, true
}
mb = NewMediaBuffer(media, chunkSize)
_, _, _, err := mb.Chunk()
// If err is io.EOF, we can upload this in a single request. Otherwise, err is
// either nil or a non-EOF error. If it is the latter, then the next call to
// mb.Chunk will return the same error. Returning a MediaBuffer ensures that this
// error will be handled at some point.
return nil, mb, err == io.EOF
}
// MediaInfo holds information for media uploads. It is intended for use by generated
// code only.
type MediaInfo struct {
// At most one of Media and MediaBuffer will be set.
media io.Reader
buffer *MediaBuffer
singleChunk bool
mType string
size int64 // mediaSize, if known. Used only for calls to progressUpdater_.
progressUpdater googleapi.ProgressUpdater
}
// NewInfoFromMedia should be invoked from the Media method of a call. It returns a
// MediaInfo populated with chunk size and content type, and a reader or MediaBuffer
// if needed.
func NewInfoFromMedia(r io.Reader, options []googleapi.MediaOption) *MediaInfo {
mi := &MediaInfo{}
opts := googleapi.ProcessMediaOptions(options)
if !opts.ForceEmptyContentType {
r, mi.mType = DetermineContentType(r, opts.ContentType)
}
mi.media, mi.buffer, mi.singleChunk = PrepareUpload(r, opts.ChunkSize)
return mi
}
// NewInfoFromResumableMedia should be invoked from the ResumableMedia method of a
// call. It returns a MediaInfo using the given reader, size and media type.
func NewInfoFromResumableMedia(r io.ReaderAt, size int64, mediaType string) *MediaInfo {
rdr := ReaderAtToReader(r, size)
rdr, mType := DetermineContentType(rdr, mediaType)
return &MediaInfo{
size: size,
mType: mType,
buffer: NewMediaBuffer(rdr, googleapi.DefaultUploadChunkSize),
media: nil,
singleChunk: false,
}
}
func (mi *MediaInfo) SetProgressUpdater(pu googleapi.ProgressUpdater) {
if mi != nil {
mi.progressUpdater = pu
}
}
mb := NewMediaBuffer(media, chunkSize)
rdr, _, _, err := mb.Chunk()
// UploadType determines the type of upload: a single request, or a resumable
// series of requests.
func (mi *MediaInfo) UploadType() string {
if mi.singleChunk {
return "multipart"
}
return "resumable"
}
if err == io.EOF { // we can upload this in a single request
return rdr, nil
// UploadRequest sets up an HTTP request for media upload. It adds headers
// as necessary, and returns a replacement for the body.
func (mi *MediaInfo) UploadRequest(reqHeaders http.Header, body io.Reader) (newBody io.Reader, cleanup func()) {
cleanup = func() {}
if mi == nil {
return body, cleanup
}
var media io.Reader
if mi.media != nil {
// This only happens when the caller has turned off chunking. In that
// case, we write all of media in a single non-retryable request.
media = mi.media
} else if mi.singleChunk {
// The data fits in a single chunk, which has now been read into the MediaBuffer.
// We obtain that chunk so we can write it in a single request. The request can
// be retried because the data is stored in the MediaBuffer.
media, _, _, _ = mi.buffer.Chunk()
}
if media != nil {
combined, ctype := CombineBodyMedia(body, "application/json", media, mi.mType)
cleanup = func() { combined.Close() }
reqHeaders.Set("Content-Type", ctype)
body = combined
}
// err might be a non-EOF error. If it is, the next call to mb.Chunk will
// return the same error. Returning a MediaBuffer ensures that this error
// will be handled at some point.
if mi.buffer != nil && mi.mType != "" && !mi.singleChunk {
reqHeaders.Set("X-Upload-Content-Type", mi.mType)
}
return body, cleanup
}
return nil, mb
// ResumableUpload returns an appropriately configured ResumableUpload value if the
// upload is resumable, or nil otherwise.
func (mi *MediaInfo) ResumableUpload(locURI string) *ResumableUpload {
if mi == nil || mi.singleChunk {
return nil
}
return &ResumableUpload{
URI: locURI,
Media: mi.buffer,
MediaType: mi.mType,
Callback: func(curr int64) {
if mi.progressUpdater != nil {
mi.progressUpdater(curr, mi.size)
}
},
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment