blob: 9ac7bff6d201773b948a42bf650ad274fefbc8e3 [file] [log] [blame]
// Package resourceviews provides access to the Google Compute Engine Instance Groups API.
//
// See https://developers.google.com/compute/
//
// Usage example:
//
// import "google.golang.org/api/resourceviews/v1beta2"
// ...
// resourceviewsService, err := resourceviews.New(oauthHttpClient)
package resourceviews // import "google.golang.org/api/resourceviews/v1beta2"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
context "golang.org/x/net/context"
ctxhttp "golang.org/x/net/context/ctxhttp"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "resourceviews:v1beta2"
const apiName = "resourceviews"
const apiVersion = "v1beta2"
const basePath = "https://www.googleapis.com/resourceviews/v1beta2/projects/"
// OAuth2 scopes used by this API.
const (
// View and manage your data across Google Cloud Platform services
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
// View your data across Google Cloud Platform services
CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"
// View and manage your Google Compute Engine resources
ComputeScope = "https://www.googleapis.com/auth/compute"
// View your Google Compute Engine resources
ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
// View and manage your Google Cloud Platform management resources and
// deployment status information
NdevCloudmanScope = "https://www.googleapis.com/auth/ndev.cloudman"
// View your Google Cloud Platform management resources and deployment
// status information
NdevCloudmanReadonlyScope = "https://www.googleapis.com/auth/ndev.cloudman.readonly"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.ZoneOperations = NewZoneOperationsService(s)
s.ZoneViews = NewZoneViewsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
ZoneOperations *ZoneOperationsService
ZoneViews *ZoneViewsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewZoneOperationsService(s *Service) *ZoneOperationsService {
rs := &ZoneOperationsService{s: s}
return rs
}
type ZoneOperationsService struct {
s *Service
}
func NewZoneViewsService(s *Service) *ZoneViewsService {
rs := &ZoneViewsService{s: s}
return rs
}
type ZoneViewsService struct {
s *Service
}
// Label: The Label to be applied to the resource views.
type Label struct {
// Key: Key of the label.
Key string `json:"key,omitempty"`
// Value: Value of the label.
Value string `json:"value,omitempty"`
// ForceSendFields is a list of field names (e.g. "Key") 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 *Label) MarshalJSON() ([]byte, error) {
type noMethod Label
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ListResourceResponseItem: The list response item that contains the
// resource and end points information.
type ListResourceResponseItem struct {
// Endpoints: The list of service end points on the resource.
Endpoints *ListResourceResponseItemEndpoints `json:"endpoints,omitempty"`
// Resource: The full URL of the resource.
Resource string `json:"resource,omitempty"`
// ForceSendFields is a list of field names (e.g. "Endpoints") 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 *ListResourceResponseItem) MarshalJSON() ([]byte, error) {
type noMethod ListResourceResponseItem
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ListResourceResponseItemEndpoints: The list of service end points on
// the resource.
type ListResourceResponseItemEndpoints struct {
}
// Operation: An operation resource, used to manage asynchronous API
// requests.
type Operation struct {
// ClientOperationId: [Output only] An optional identifier specified by
// the client when the mutation was initiated. Must be unique for all
// operation resources in the project.
ClientOperationId string `json:"clientOperationId,omitempty"`
// CreationTimestamp: [Output Only] The time that this operation was
// requested, in RFC3339 text format.
CreationTimestamp string `json:"creationTimestamp,omitempty"`
// EndTime: [Output Only] The time that this operation was completed, in
// RFC3339 text format.
EndTime string `json:"endTime,omitempty"`
// Error: [Output Only] If errors occurred during processing of this
// operation, this field will be populated.
Error *OperationError `json:"error,omitempty"`
// HttpErrorMessage: [Output only] If operation fails, the HTTP error
// message returned.
HttpErrorMessage string `json:"httpErrorMessage,omitempty"`
// HttpErrorStatusCode: [Output only] If operation fails, the HTTP error
// status code returned.
HttpErrorStatusCode int64 `json:"httpErrorStatusCode,omitempty"`
// Id: [Output Only] Unique identifier for the resource, generated by
// the server.
Id uint64 `json:"id,omitempty,string"`
// InsertTime: [Output Only] The time that this operation was requested,
// in RFC3339 text format.
InsertTime string `json:"insertTime,omitempty"`
// Kind: [Output only] Type of the resource.
Kind string `json:"kind,omitempty"`
// Name: [Output Only] Name of the resource.
Name string `json:"name,omitempty"`
// OperationType: [Output only] Type of the operation. Operations
// include insert, update, and delete.
OperationType string `json:"operationType,omitempty"`
// Progress: [Output only] An optional progress indicator that ranges
// from 0 to 100. There is no requirement that this be linear or support
// any granularity of operations. This should not be used to guess at
// when the operation will be complete. This number should be
// monotonically increasing as the operation progresses.
Progress int64 `json:"progress,omitempty"`
// Region: [Output Only] URL of the region where the operation resides.
// Only available when performing regional operations.
Region string `json:"region,omitempty"`
// SelfLink: [Output Only] Server-defined fully-qualified URL for this
// resource.
SelfLink string `json:"selfLink,omitempty"`
// StartTime: [Output Only] The time that this operation was started by
// the server, in RFC3339 text format.
StartTime string `json:"startTime,omitempty"`
// Status: [Output Only] Status of the operation.
Status string `json:"status,omitempty"`
// StatusMessage: [Output Only] An optional textual description of the
// current status of the operation.
StatusMessage string `json:"statusMessage,omitempty"`
// TargetId: [Output Only] Unique target ID which identifies a
// particular incarnation of the target.
TargetId uint64 `json:"targetId,omitempty,string"`
// TargetLink: [Output only] URL of the resource the operation is
// mutating.
TargetLink string `json:"targetLink,omitempty"`
// User: [Output Only] User who requested the operation, for example:
// user@example.com.
User string `json:"user,omitempty"`
// Warnings: [Output Only] If there are issues with this operation, a
// warning is returned.
Warnings []*OperationWarnings `json:"warnings,omitempty"`
// Zone: [Output Only] URL of the zone where the operation resides. Only
// available when performing per-zone operations.
Zone string `json:"zone,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "ClientOperationId")
// 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 *Operation) MarshalJSON() ([]byte, error) {
type noMethod Operation
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// OperationError: [Output Only] If errors occurred during processing of
// this operation, this field will be populated.
type OperationError struct {
// Errors: [Output Only] The array of errors encountered while
// processing this operation.
Errors []*OperationErrorErrors `json:"errors,omitempty"`
// ForceSendFields is a list of field names (e.g. "Errors") 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 *OperationError) MarshalJSON() ([]byte, error) {
type noMethod OperationError
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type OperationErrorErrors struct {
// Code: [Output Only] The error type identifier for this error.
Code string `json:"code,omitempty"`
// Location: [Output Only] Indicates the field in the request which
// caused the error. This property is optional.
Location string `json:"location,omitempty"`
// Message: [Output Only] An optional, human-readable error message.
Message string `json:"message,omitempty"`
// ForceSendFields is a list of field names (e.g. "Code") 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 *OperationErrorErrors) MarshalJSON() ([]byte, error) {
type noMethod OperationErrorErrors
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type OperationWarnings struct {
// Code: [Output only] The warning type identifier for this warning.
Code string `json:"code,omitempty"`
// Data: [Output only] Metadata for this warning in key:value format.
Data []*OperationWarningsData `json:"data,omitempty"`
// Message: [Output only] Optional human-readable details for this
// warning.
Message string `json:"message,omitempty"`
// ForceSendFields is a list of field names (e.g. "Code") 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 *OperationWarnings) MarshalJSON() ([]byte, error) {
type noMethod OperationWarnings
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type OperationWarningsData struct {
// Key: [Output Only] Metadata key for this warning.
Key string `json:"key,omitempty"`
// Value: [Output Only] Metadata value for this warning.
Value string `json:"value,omitempty"`
// ForceSendFields is a list of field names (e.g. "Key") 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 *OperationWarningsData) MarshalJSON() ([]byte, error) {
type noMethod OperationWarningsData
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type OperationList struct {
// Id: Unique identifier for the resource; defined by the server (output
// only).
Id string `json:"id,omitempty"`
// Items: The operation resources.
Items []*Operation `json:"items,omitempty"`
// Kind: Type of resource.
Kind string `json:"kind,omitempty"`
// NextPageToken: A token used to continue a truncated list request
// (output only).
NextPageToken string `json:"nextPageToken,omitempty"`
// SelfLink: Server defined URL for this resource (output only).
SelfLink string `json:"selfLink,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Id") 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 *OperationList) MarshalJSON() ([]byte, error) {
type noMethod OperationList
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ResourceView: The resource view object.
type ResourceView struct {
// CreationTimestamp: The creation time of the resource view.
CreationTimestamp string `json:"creationTimestamp,omitempty"`
// Description: The detailed description of the resource view.
Description string `json:"description,omitempty"`
// Endpoints: Services endpoint information.
Endpoints []*ServiceEndpoint `json:"endpoints,omitempty"`
// Fingerprint: The fingerprint of the service endpoint information.
Fingerprint string `json:"fingerprint,omitempty"`
// Id: [Output Only] The ID of the resource view.
Id string `json:"id,omitempty"`
// Kind: Type of the resource.
Kind string `json:"kind,omitempty"`
// Labels: The labels for events.
Labels []*Label `json:"labels,omitempty"`
// Name: The name of the resource view.
Name string `json:"name,omitempty"`
// Network: The URL of a Compute Engine network to which the resources
// in the view belong.
Network string `json:"network,omitempty"`
// Resources: A list of all resources in the resource view.
Resources []string `json:"resources,omitempty"`
// SelfLink: [Output Only] A self-link to the resource view.
SelfLink string `json:"selfLink,omitempty"`
// Size: The total number of resources in the resource view.
Size int64 `json:"size,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CreationTimestamp")
// 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 *ResourceView) MarshalJSON() ([]byte, error) {
type noMethod ResourceView
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ServiceEndpoint: The service endpoint that may be started in a VM.
type ServiceEndpoint struct {
// Name: The name of the service endpoint.
Name string `json:"name,omitempty"`
// Port: The port of the service endpoint.
Port int64 `json:"port,omitempty"`
// ForceSendFields is a list of field names (e.g. "Name") 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 *ServiceEndpoint) MarshalJSON() ([]byte, error) {
type noMethod ServiceEndpoint
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ZoneViewsAddResourcesRequest: The request to add resources to the
// resource view.
type ZoneViewsAddResourcesRequest struct {
// Resources: The list of resources to be added.
Resources []string `json:"resources,omitempty"`
// ForceSendFields is a list of field names (e.g. "Resources") 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 *ZoneViewsAddResourcesRequest) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsAddResourcesRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type ZoneViewsGetServiceResponse struct {
// Endpoints: The service information.
Endpoints []*ServiceEndpoint `json:"endpoints,omitempty"`
// Fingerprint: The fingerprint of the service information.
Fingerprint string `json:"fingerprint,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Endpoints") 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 *ZoneViewsGetServiceResponse) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsGetServiceResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ZoneViewsList: The response to a list request.
type ZoneViewsList struct {
// Items: The result that contains all resource views that meet the
// criteria.
Items []*ResourceView `json:"items,omitempty"`
// Kind: Type of resource.
Kind string `json:"kind,omitempty"`
// NextPageToken: A token used for pagination.
NextPageToken string `json:"nextPageToken,omitempty"`
// SelfLink: Server defined URL for this resource (output only).
SelfLink string `json:"selfLink,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") 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 *ZoneViewsList) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsList
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ZoneViewsListResourcesResponse: The response to a list resource
// request.
type ZoneViewsListResourcesResponse struct {
// Items: The formatted JSON that is requested by the user.
Items []*ListResourceResponseItem `json:"items,omitempty"`
// Network: The URL of a Compute Engine network to which the resources
// in the view belong.
Network string `json:"network,omitempty"`
// NextPageToken: A token used for pagination.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") 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 *ZoneViewsListResourcesResponse) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsListResourcesResponse
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// ZoneViewsRemoveResourcesRequest: The request to remove resources from
// the resource view.
type ZoneViewsRemoveResourcesRequest struct {
// Resources: The list of resources to be removed.
Resources []string `json:"resources,omitempty"`
// ForceSendFields is a list of field names (e.g. "Resources") 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 *ZoneViewsRemoveResourcesRequest) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsRemoveResourcesRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
type ZoneViewsSetServiceRequest struct {
// Endpoints: The service information to be updated.
Endpoints []*ServiceEndpoint `json:"endpoints,omitempty"`
// Fingerprint: Fingerprint of the service information; a hash of the
// contents. This field is used for optimistic locking when updating the
// service entries.
Fingerprint string `json:"fingerprint,omitempty"`
// ResourceName: The name of the resource if user wants to update the
// service information of the resource.
ResourceName string `json:"resourceName,omitempty"`
// ForceSendFields is a list of field names (e.g. "Endpoints") 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 *ZoneViewsSetServiceRequest) MarshalJSON() ([]byte, error) {
type noMethod ZoneViewsSetServiceRequest
raw := noMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields)
}
// method id "resourceviews.zoneOperations.get":
type ZoneOperationsGetCall struct {
s *Service
project string
zone string
operation string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
}
// Get: Retrieves the specified zone-specific operation resource.
func (r *ZoneOperationsService) Get(project string, zone string, operation string) *ZoneOperationsGetCall {
c := &ZoneOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.operation = operation
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneOperationsGetCall) Fields(s ...googleapi.Field) *ZoneOperationsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ZoneOperationsGetCall) IfNoneMatch(entityTag string) *ZoneOperationsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneOperationsGetCall) Context(ctx context.Context) *ZoneOperationsGetCall {
c.ctx_ = ctx
return c
}
func (c *ZoneOperationsGetCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations/{operation}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"operation": c.operation,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneOperations.get" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves the specified zone-specific operation resource.",
// "httpMethod": "GET",
// "id": "resourceviews.zoneOperations.get",
// "parameterOrder": [
// "project",
// "zone",
// "operation"
// ],
// "parameters": {
// "operation": {
// "description": "Name of the operation resource to return.",
// "location": "path",
// "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
// "required": true,
// "type": "string"
// },
// "project": {
// "description": "Name of the project scoping this request.",
// "location": "path",
// "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "Name of the zone scoping this request.",
// "location": "path",
// "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/operations/{operation}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/compute.readonly",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
// method id "resourceviews.zoneOperations.list":
type ZoneOperationsListCall struct {
s *Service
project string
zone string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
}
// List: Retrieves the list of operation resources contained within the
// specified zone.
func (r *ZoneOperationsService) List(project string, zone string) *ZoneOperationsListCall {
c := &ZoneOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
return c
}
// Filter sets the optional parameter "filter": Filter expression for
// filtering listed resources.
func (c *ZoneOperationsListCall) Filter(filter string) *ZoneOperationsListCall {
c.urlParams_.Set("filter", filter)
return c
}
// MaxResults sets the optional parameter "maxResults": Maximum count of
// results to be returned. Maximum value is 500 and default value is
// 500.
func (c *ZoneOperationsListCall) MaxResults(maxResults int64) *ZoneOperationsListCall {
c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
return c
}
// PageToken sets the optional parameter "pageToken": Tag returned by a
// previous list request truncated by maxResults. Used to continue a
// previous list request.
func (c *ZoneOperationsListCall) PageToken(pageToken string) *ZoneOperationsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneOperationsListCall) Fields(s ...googleapi.Field) *ZoneOperationsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ZoneOperationsListCall) IfNoneMatch(entityTag string) *ZoneOperationsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneOperationsListCall) Context(ctx context.Context) *ZoneOperationsListCall {
c.ctx_ = ctx
return c
}
func (c *ZoneOperationsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneOperations.list" call.
// Exactly one of *OperationList or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *OperationList.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ZoneOperationsListCall) Do(opts ...googleapi.CallOption) (*OperationList, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &OperationList{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves the list of operation resources contained within the specified zone.",
// "httpMethod": "GET",
// "id": "resourceviews.zoneOperations.list",
// "parameterOrder": [
// "project",
// "zone"
// ],
// "parameters": {
// "filter": {
// "description": "Optional. Filter expression for filtering listed resources.",
// "location": "query",
// "type": "string"
// },
// "maxResults": {
// "default": "500",
// "description": "Optional. Maximum count of results to be returned. Maximum value is 500 and default value is 500.",
// "format": "uint32",
// "location": "query",
// "maximum": "500",
// "minimum": "0",
// "type": "integer"
// },
// "pageToken": {
// "description": "Optional. Tag returned by a previous list request truncated by maxResults. Used to continue a previous list request.",
// "location": "query",
// "type": "string"
// },
// "project": {
// "description": "Name of the project scoping this request.",
// "location": "path",
// "pattern": "(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "Name of the zone scoping this request.",
// "location": "path",
// "pattern": "[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/operations",
// "response": {
// "$ref": "OperationList"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/compute.readonly",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
// method id "resourceviews.zoneViews.addResources":
type ZoneViewsAddResourcesCall struct {
s *Service
project string
zone string
resourceView string
zoneviewsaddresourcesrequest *ZoneViewsAddResourcesRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// AddResources: Add resources to the view.
func (r *ZoneViewsService) AddResources(project string, zone string, resourceView string, zoneviewsaddresourcesrequest *ZoneViewsAddResourcesRequest) *ZoneViewsAddResourcesCall {
c := &ZoneViewsAddResourcesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
c.zoneviewsaddresourcesrequest = zoneviewsaddresourcesrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsAddResourcesCall) Fields(s ...googleapi.Field) *ZoneViewsAddResourcesCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsAddResourcesCall) Context(ctx context.Context) *ZoneViewsAddResourcesCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsAddResourcesCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewsaddresourcesrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/addResources")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.addResources" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsAddResourcesCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Add resources to the view.",
// "httpMethod": "POST",
// "id": "resourceviews.zoneViews.addResources",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}/addResources",
// "request": {
// "$ref": "ZoneViewsAddResourcesRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}
// method id "resourceviews.zoneViews.delete":
type ZoneViewsDeleteCall struct {
s *Service
project string
zone string
resourceView string
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// Delete: Delete a resource view.
func (r *ZoneViewsService) Delete(project string, zone string, resourceView string) *ZoneViewsDeleteCall {
c := &ZoneViewsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsDeleteCall) Fields(s ...googleapi.Field) *ZoneViewsDeleteCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsDeleteCall) Context(ctx context.Context) *ZoneViewsDeleteCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsDeleteCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.delete" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Delete a resource view.",
// "httpMethod": "DELETE",
// "id": "resourceviews.zoneViews.delete",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}
// method id "resourceviews.zoneViews.get":
type ZoneViewsGetCall struct {
s *Service
project string
zone string
resourceView string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
}
// Get: Get the information of a zonal resource view.
func (r *ZoneViewsService) Get(project string, zone string, resourceView string) *ZoneViewsGetCall {
c := &ZoneViewsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsGetCall) Fields(s ...googleapi.Field) *ZoneViewsGetCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ZoneViewsGetCall) IfNoneMatch(entityTag string) *ZoneViewsGetCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsGetCall) Context(ctx context.Context) *ZoneViewsGetCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsGetCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.get" call.
// Exactly one of *ResourceView or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *ResourceView.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsGetCall) Do(opts ...googleapi.CallOption) (*ResourceView, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ResourceView{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get the information of a zonal resource view.",
// "httpMethod": "GET",
// "id": "resourceviews.zoneViews.get",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}",
// "response": {
// "$ref": "ResourceView"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/compute.readonly",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
// method id "resourceviews.zoneViews.getService":
type ZoneViewsGetServiceCall struct {
s *Service
project string
zone string
resourceView string
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// GetService: Get the service information of a resource view or a
// resource.
func (r *ZoneViewsService) GetService(project string, zone string, resourceView string) *ZoneViewsGetServiceCall {
c := &ZoneViewsGetServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
return c
}
// ResourceName sets the optional parameter "resourceName": The name of
// the resource if user wants to get the service information of the
// resource.
func (c *ZoneViewsGetServiceCall) ResourceName(resourceName string) *ZoneViewsGetServiceCall {
c.urlParams_.Set("resourceName", resourceName)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsGetServiceCall) Fields(s ...googleapi.Field) *ZoneViewsGetServiceCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsGetServiceCall) Context(ctx context.Context) *ZoneViewsGetServiceCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsGetServiceCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/getService")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.getService" call.
// Exactly one of *ZoneViewsGetServiceResponse or error will be non-nil.
// Any non-2xx status code is an error. Response headers are in either
// *ZoneViewsGetServiceResponse.ServerResponse.Header or (if a response
// was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ZoneViewsGetServiceCall) Do(opts ...googleapi.CallOption) (*ZoneViewsGetServiceResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ZoneViewsGetServiceResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Get the service information of a resource view or a resource.",
// "httpMethod": "POST",
// "id": "resourceviews.zoneViews.getService",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceName": {
// "description": "The name of the resource if user wants to get the service information of the resource.",
// "location": "query",
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}/getService",
// "response": {
// "$ref": "ZoneViewsGetServiceResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}
// method id "resourceviews.zoneViews.insert":
type ZoneViewsInsertCall struct {
s *Service
project string
zone string
resourceview *ResourceView
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// Insert: Create a resource view.
func (r *ZoneViewsService) Insert(project string, zone string, resourceview *ResourceView) *ZoneViewsInsertCall {
c := &ZoneViewsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceview = resourceview
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsInsertCall) Fields(s ...googleapi.Field) *ZoneViewsInsertCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsInsertCall) Context(ctx context.Context) *ZoneViewsInsertCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsInsertCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.resourceview)
if err != nil {
return nil, err
}
ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.insert" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsInsertCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Create a resource view.",
// "httpMethod": "POST",
// "id": "resourceviews.zoneViews.insert",
// "parameterOrder": [
// "project",
// "zone"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews",
// "request": {
// "$ref": "ResourceView"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}
// method id "resourceviews.zoneViews.list":
type ZoneViewsListCall struct {
s *Service
project string
zone string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
}
// List: List resource views.
func (r *ZoneViewsService) List(project string, zone string) *ZoneViewsListCall {
c := &ZoneViewsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
return c
}
// MaxResults sets the optional parameter "maxResults": Maximum count of
// results to be returned. Acceptable values are 0 to 5000, inclusive.
// (Default: 5000)
func (c *ZoneViewsListCall) MaxResults(maxResults int64) *ZoneViewsListCall {
c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
return c
}
// PageToken sets the optional parameter "pageToken": Specifies a
// nextPageToken returned by a previous list request. This token can be
// used to request the next page of results from a previous list
// request.
func (c *ZoneViewsListCall) PageToken(pageToken string) *ZoneViewsListCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsListCall) Fields(s ...googleapi.Field) *ZoneViewsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ZoneViewsListCall) IfNoneMatch(entityTag string) *ZoneViewsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsListCall) Context(ctx context.Context) *ZoneViewsListCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsListCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.list" call.
// Exactly one of *ZoneViewsList or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *ZoneViewsList.ServerResponse.Header or (if a response was returned
// at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ZoneViewsListCall) Do(opts ...googleapi.CallOption) (*ZoneViewsList, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ZoneViewsList{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "List resource views.",
// "httpMethod": "GET",
// "id": "resourceviews.zoneViews.list",
// "parameterOrder": [
// "project",
// "zone"
// ],
// "parameters": {
// "maxResults": {
// "default": "5000",
// "description": "Maximum count of results to be returned. Acceptable values are 0 to 5000, inclusive. (Default: 5000)",
// "format": "int32",
// "location": "query",
// "maximum": "5000",
// "minimum": "0",
// "type": "integer"
// },
// "pageToken": {
// "description": "Specifies a nextPageToken returned by a previous list request. This token can be used to request the next page of results from a previous list request.",
// "location": "query",
// "type": "string"
// },
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews",
// "response": {
// "$ref": "ZoneViewsList"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/compute.readonly",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
// method id "resourceviews.zoneViews.listResources":
type ZoneViewsListResourcesCall struct {
s *Service
project string
zone string
resourceView string
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
}
// ListResources: List the resources of the resource view.
func (r *ZoneViewsService) ListResources(project string, zone string, resourceView string) *ZoneViewsListResourcesCall {
c := &ZoneViewsListResourcesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
return c
}
// Format sets the optional parameter "format": The requested format of
// the return value. It can be URL or URL_PORT. A JSON object will be
// included in the response based on the format. The default format is
// NONE, which results in no JSON in the response.
//
// Possible values:
// "NONE"
// "URL"
// "URL_PORT"
func (c *ZoneViewsListResourcesCall) Format(format string) *ZoneViewsListResourcesCall {
c.urlParams_.Set("format", format)
return c
}
// ListState sets the optional parameter "listState": The state of the
// instance to list. By default, it lists all instances.
//
// Possible values:
// "ALL" (default)
// "RUNNING"
func (c *ZoneViewsListResourcesCall) ListState(listState string) *ZoneViewsListResourcesCall {
c.urlParams_.Set("listState", listState)
return c
}
// MaxResults sets the optional parameter "maxResults": Maximum count of
// results to be returned. Acceptable values are 0 to 5000, inclusive.
// (Default: 5000)
func (c *ZoneViewsListResourcesCall) MaxResults(maxResults int64) *ZoneViewsListResourcesCall {
c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
return c
}
// PageToken sets the optional parameter "pageToken": Specifies a
// nextPageToken returned by a previous list request. This token can be
// used to request the next page of results from a previous list
// request.
func (c *ZoneViewsListResourcesCall) PageToken(pageToken string) *ZoneViewsListResourcesCall {
c.urlParams_.Set("pageToken", pageToken)
return c
}
// ServiceName sets the optional parameter "serviceName": The service
// name to return in the response. It is optional and if it is not set,
// all the service end points will be returned.
func (c *ZoneViewsListResourcesCall) ServiceName(serviceName string) *ZoneViewsListResourcesCall {
c.urlParams_.Set("serviceName", serviceName)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsListResourcesCall) Fields(s ...googleapi.Field) *ZoneViewsListResourcesCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// IfNoneMatch sets the optional parameter which makes the operation
// fail if the object's ETag matches the given value. This is useful for
// getting updates only after the object has changed since the last
// request. Use googleapi.IsNotModified to check whether the response
// error from Do is the result of In-None-Match.
func (c *ZoneViewsListResourcesCall) IfNoneMatch(entityTag string) *ZoneViewsListResourcesCall {
c.ifNoneMatch_ = entityTag
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsListResourcesCall) Context(ctx context.Context) *ZoneViewsListResourcesCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsListResourcesCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/resources")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
req.Header.Set("If-None-Match", c.ifNoneMatch_)
}
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.listResources" call.
// Exactly one of *ZoneViewsListResourcesResponse or error will be
// non-nil. Any non-2xx status code is an error. Response headers are in
// either *ZoneViewsListResourcesResponse.ServerResponse.Header or (if a
// response was returned at all) in error.(*googleapi.Error).Header. Use
// googleapi.IsNotModified to check whether the returned error was
// because http.StatusNotModified was returned.
func (c *ZoneViewsListResourcesCall) Do(opts ...googleapi.CallOption) (*ZoneViewsListResourcesResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ZoneViewsListResourcesResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "List the resources of the resource view.",
// "httpMethod": "GET",
// "id": "resourceviews.zoneViews.listResources",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "format": {
// "description": "The requested format of the return value. It can be URL or URL_PORT. A JSON object will be included in the response based on the format. The default format is NONE, which results in no JSON in the response.",
// "enum": [
// "NONE",
// "URL",
// "URL_PORT"
// ],
// "enumDescriptions": [
// "",
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "listState": {
// "default": "ALL",
// "description": "The state of the instance to list. By default, it lists all instances.",
// "enum": [
// "ALL",
// "RUNNING"
// ],
// "enumDescriptions": [
// "",
// ""
// ],
// "location": "query",
// "type": "string"
// },
// "maxResults": {
// "default": "5000",
// "description": "Maximum count of results to be returned. Acceptable values are 0 to 5000, inclusive. (Default: 5000)",
// "format": "int32",
// "location": "query",
// "maximum": "5000",
// "minimum": "0",
// "type": "integer"
// },
// "pageToken": {
// "description": "Specifies a nextPageToken returned by a previous list request. This token can be used to request the next page of results from a previous list request.",
// "location": "query",
// "type": "string"
// },
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "serviceName": {
// "description": "The service name to return in the response. It is optional and if it is not set, all the service end points will be returned.",
// "location": "query",
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}/resources",
// "response": {
// "$ref": "ZoneViewsListResourcesResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/compute.readonly",
// "https://www.googleapis.com/auth/ndev.cloudman",
// "https://www.googleapis.com/auth/ndev.cloudman.readonly"
// ]
// }
}
// method id "resourceviews.zoneViews.removeResources":
type ZoneViewsRemoveResourcesCall struct {
s *Service
project string
zone string
resourceView string
zoneviewsremoveresourcesrequest *ZoneViewsRemoveResourcesRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// RemoveResources: Remove resources from the view.
func (r *ZoneViewsService) RemoveResources(project string, zone string, resourceView string, zoneviewsremoveresourcesrequest *ZoneViewsRemoveResourcesRequest) *ZoneViewsRemoveResourcesCall {
c := &ZoneViewsRemoveResourcesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
c.zoneviewsremoveresourcesrequest = zoneviewsremoveresourcesrequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsRemoveResourcesCall) Fields(s ...googleapi.Field) *ZoneViewsRemoveResourcesCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsRemoveResourcesCall) Context(ctx context.Context) *ZoneViewsRemoveResourcesCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsRemoveResourcesCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewsremoveresourcesrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/removeResources")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.removeResources" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsRemoveResourcesCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Remove resources from the view.",
// "httpMethod": "POST",
// "id": "resourceviews.zoneViews.removeResources",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}/removeResources",
// "request": {
// "$ref": "ZoneViewsRemoveResourcesRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}
// method id "resourceviews.zoneViews.setService":
type ZoneViewsSetServiceCall struct {
s *Service
project string
zone string
resourceView string
zoneviewssetservicerequest *ZoneViewsSetServiceRequest
urlParams_ gensupport.URLParams
ctx_ context.Context
}
// SetService: Update the service information of a resource view or a
// resource.
func (r *ZoneViewsService) SetService(project string, zone string, resourceView string, zoneviewssetservicerequest *ZoneViewsSetServiceRequest) *ZoneViewsSetServiceCall {
c := &ZoneViewsSetServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
c.project = project
c.zone = zone
c.resourceView = resourceView
c.zoneviewssetservicerequest = zoneviewssetservicerequest
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *ZoneViewsSetServiceCall) Fields(s ...googleapi.Field) *ZoneViewsSetServiceCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// Context sets the context to be used in this call's Do method. Any
// pending HTTP request will be aborted if the provided context is
// canceled.
func (c *ZoneViewsSetServiceCall) Context(ctx context.Context) *ZoneViewsSetServiceCall {
c.ctx_ = ctx
return c
}
func (c *ZoneViewsSetServiceCall) doRequest(alt string) (*http.Response, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewssetservicerequest)
if err != nil {
return nil, err
}
ctype := "application/json"
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/setService")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"project": c.project,
"zone": c.zone,
"resourceView": c.resourceView,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
if c.ctx_ != nil {
return ctxhttp.Do(c.ctx_, c.s.client, req)
}
return c.s.client.Do(req)
}
// Do executes the "resourceviews.zoneViews.setService" call.
// Exactly one of *Operation or error will be non-nil. Any non-2xx
// status code is an error. Response headers are in either
// *Operation.ServerResponse.Header or (if a response was returned at
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
// to check whether the returned error was because
// http.StatusNotModified was returned.
func (c *ZoneViewsSetServiceCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &Operation{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Update the service information of a resource view or a resource.",
// "httpMethod": "POST",
// "id": "resourceviews.zoneViews.setService",
// "parameterOrder": [
// "project",
// "zone",
// "resourceView"
// ],
// "parameters": {
// "project": {
// "description": "The project name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "resourceView": {
// "description": "The name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zone": {
// "description": "The zone name of the resource view.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{project}/zones/{zone}/resourceViews/{resourceView}/setService",
// "request": {
// "$ref": "ZoneViewsSetServiceRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/compute",
// "https://www.googleapis.com/auth/ndev.cloudman"
// ]
// }
}