// Package resourceviews provides access to the Resource Views API. // // See https://developers.google.com/compute/ // // Usage example: // // import "google.golang.org/api/resourceviews/v1beta2" // ... // resourceviewsService, err := resourceviews.New(oauthHttpClient) package resourceviews import ( "bytes" "encoding/json" "errors" "fmt" "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 _ = googleapi.Version var _ = errors.New var _ = strings.Replace 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 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 ZoneOperations *ZoneOperationsService ZoneViews *ZoneViewsService } 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 } type Label struct { // Key: Key of the label. Key string `json:"key,omitempty"` // Value: Value of the label. Value string `json:"value,omitempty"` } 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"` } type ListResourceResponseItemEndpoints struct { } 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"` } type OperationError struct { // Errors: [Output Only] The array of errors encountered while // processing this operation. Errors []*OperationErrorErrors `json:"errors,omitempty"` } 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"` } 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"` } 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"` } 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"` } 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"` } 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"` } type ZoneViewsAddResourcesRequest struct { // Resources: The list of resources to be added. Resources []string `json:"resources,omitempty"` } type ZoneViewsGetServiceResponse struct { // Endpoints: The service information. Endpoints []*ServiceEndpoint `json:"endpoints,omitempty"` // Fingerprint: The fingerprint of the service information. Fingerprint string `json:"fingerprint,omitempty"` } 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"` } 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"` } type ZoneViewsRemoveResourcesRequest struct { // Resources: The list of resources to be removed. Resources []string `json:"resources,omitempty"` } 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"` } // method id "resourceviews.zoneOperations.get": type ZoneOperationsGetCall struct { s *Service project string zone string operation string opt_ map[string]interface{} } // Get: Retrieves the specified zone-specific operation resource. func (r *ZoneOperationsService) Get(project string, zone string, operation string) *ZoneOperationsGetCall { c := &ZoneOperationsGetCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneOperationsGetCall) Do() (*Operation, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations/{operation}") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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/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 opt_ map[string]interface{} } // 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, opt_: make(map[string]interface{})} 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.opt_["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.opt_["maxResults"] = 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.opt_["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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneOperationsListCall) Do() (*OperationList, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["filter"]; ok { params.Set("filter", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["maxResults"]; ok { params.Set("maxResults", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["pageToken"]; ok { params.Set("pageToken", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/operations") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *OperationList 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/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 opt_ map[string]interface{} } // AddResources: Add resources to the view. func (r *ZoneViewsService) AddResources(project string, zone string, resourceView string, zoneviewsaddresourcesrequest *ZoneViewsAddResourcesRequest) *ZoneViewsAddResourcesCall { c := &ZoneViewsAddResourcesCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsAddResourcesCall) Do() (*Operation, error) { var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewsaddresourcesrequest) if err != nil { return nil, err } ctype := "application/json" params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/addResources") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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 opt_ map[string]interface{} } // Delete: Delete a resource view. func (r *ZoneViewsService) Delete(project string, zone string, resourceView string) *ZoneViewsDeleteCall { c := &ZoneViewsDeleteCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsDeleteCall) Do() (*Operation, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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 opt_ map[string]interface{} } // 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, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsGetCall) Do() (*ResourceView, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *ResourceView 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/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 opt_ map[string]interface{} } // 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, opt_: make(map[string]interface{})} 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.opt_["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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsGetServiceCall) Do() (*ZoneViewsGetServiceResponse, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["resourceName"]; ok { params.Set("resourceName", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/getService") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *ZoneViewsGetServiceResponse 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 opt_ map[string]interface{} } // Insert: Create a resource view. func (r *ZoneViewsService) Insert(project string, zone string, resourceview *ResourceView) *ZoneViewsInsertCall { c := &ZoneViewsInsertCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsInsertCall) Do() (*Operation, error) { var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.resourceview) if err != nil { return nil, err } ctype := "application/json" params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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 opt_ map[string]interface{} } // List: List resource views. func (r *ZoneViewsService) List(project string, zone string) *ZoneViewsListCall { c := &ZoneViewsListCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["maxResults"] = 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.opt_["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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsListCall) Do() (*ZoneViewsList, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["maxResults"]; ok { params.Set("maxResults", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["pageToken"]; ok { params.Set("pageToken", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *ZoneViewsList 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/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 opt_ map[string]interface{} } // ListResources: List the resources of the resource view. func (r *ZoneViewsService) ListResources(project string, zone string, resourceView string) *ZoneViewsListResourcesCall { c := &ZoneViewsListResourcesCall{s: r.s, opt_: make(map[string]interface{})} 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. func (c *ZoneViewsListResourcesCall) Format(format string) *ZoneViewsListResourcesCall { c.opt_["format"] = format return c } // ListState sets the optional parameter "listState": The state of the // instance to list. By default, it lists all instances. func (c *ZoneViewsListResourcesCall) ListState(listState string) *ZoneViewsListResourcesCall { c.opt_["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.opt_["maxResults"] = 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.opt_["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.opt_["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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsListResourcesCall) Do() (*ZoneViewsListResourcesResponse, error) { var body io.Reader = nil params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["format"]; ok { params.Set("format", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["listState"]; ok { params.Set("listState", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["maxResults"]; ok { params.Set("maxResults", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["pageToken"]; ok { params.Set("pageToken", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["serviceName"]; ok { params.Set("serviceName", fmt.Sprintf("%v", v)) } if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/resources") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *ZoneViewsListResourcesResponse 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/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 opt_ map[string]interface{} } // RemoveResources: Remove resources from the view. func (r *ZoneViewsService) RemoveResources(project string, zone string, resourceView string, zoneviewsremoveresourcesrequest *ZoneViewsRemoveResourcesRequest) *ZoneViewsRemoveResourcesCall { c := &ZoneViewsRemoveResourcesCall{s: r.s, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsRemoveResourcesCall) Do() (*Operation, error) { var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewsremoveresourcesrequest) if err != nil { return nil, err } ctype := "application/json" params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/removeResources") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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 opt_ map[string]interface{} } // 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, opt_: make(map[string]interface{})} 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.opt_["fields"] = googleapi.CombineFields(s) return c } func (c *ZoneViewsSetServiceCall) Do() (*Operation, error) { var body io.Reader = nil body, err := googleapi.WithoutDataWrapper.JSONReader(c.zoneviewssetservicerequest) if err != nil { return nil, err } ctype := "application/json" params := make(url.Values) params.Set("alt", "json") if v, ok := c.opt_["fields"]; ok { params.Set("fields", fmt.Sprintf("%v", v)) } urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/zones/{zone}/resourceViews/{resourceView}/setService") urls += "?" + params.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", "google-api-go-client/0.5") res, err := c.s.client.Do(req) if err != nil { return nil, err } defer googleapi.CloseBody(res) if err := googleapi.CheckResponse(res); err != nil { return nil, err } var ret *Operation 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" // ] // } }