1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
|
// Package container provides access to the Google Container Engine API.
//
// See https://cloud.google.com/container-engine/docs/v1beta1/
//
// Usage example:
//
// import "google.golang.org/api/container/v1beta1"
// ...
// containerService, err := container.New(oauthHttpClient)
package container
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"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
var _ = context.Background
const apiId = "container:v1beta1"
const apiName = "container"
const apiVersion = "v1beta1"
const basePath = "https://www.googleapis.com/container/v1beta1/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"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Projects = NewProjectsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Projects *ProjectsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewProjectsService(s *Service) *ProjectsService {
rs := &ProjectsService{s: s}
rs.Clusters = NewProjectsClustersService(s)
rs.Operations = NewProjectsOperationsService(s)
rs.Zones = NewProjectsZonesService(s)
return rs
}
type ProjectsService struct {
s *Service
Clusters *ProjectsClustersService
Operations *ProjectsOperationsService
Zones *ProjectsZonesService
}
func NewProjectsClustersService(s *Service) *ProjectsClustersService {
rs := &ProjectsClustersService{s: s}
return rs
}
type ProjectsClustersService struct {
s *Service
}
func NewProjectsOperationsService(s *Service) *ProjectsOperationsService {
rs := &ProjectsOperationsService{s: s}
return rs
}
type ProjectsOperationsService struct {
s *Service
}
func NewProjectsZonesService(s *Service) *ProjectsZonesService {
rs := &ProjectsZonesService{s: s}
rs.Clusters = NewProjectsZonesClustersService(s)
rs.Operations = NewProjectsZonesOperationsService(s)
return rs
}
type ProjectsZonesService struct {
s *Service
Clusters *ProjectsZonesClustersService
Operations *ProjectsZonesOperationsService
}
func NewProjectsZonesClustersService(s *Service) *ProjectsZonesClustersService {
rs := &ProjectsZonesClustersService{s: s}
return rs
}
type ProjectsZonesClustersService struct {
s *Service
}
func NewProjectsZonesOperationsService(s *Service) *ProjectsZonesOperationsService {
rs := &ProjectsZonesOperationsService{s: s}
return rs
}
type ProjectsZonesOperationsService struct {
s *Service
}
type Cluster struct {
// ClusterApiVersion: The API version of the Kubernetes master and
// kubelets running in this cluster. Leave blank to pick up the latest
// stable release, or specify a version of the form "x.y.z". The Google
// Container Engine release notes lists the currently supported
// versions. If an incorrect version is specified, the server returns an
// error listing the currently supported versions.
ClusterApiVersion string `json:"clusterApiVersion,omitempty"`
// ContainerIpv4Cidr: The IP address range of the container pods in this
// cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have
// one automatically chosen or specify a /14 block in 10.0.0.0/8 or
// 172.16.0.0/12.
ContainerIpv4Cidr string `json:"containerIpv4Cidr,omitempty"`
// CreationTimestamp: [Output only] The time the cluster was created, in
// RFC3339 text format.
CreationTimestamp string `json:"creationTimestamp,omitempty"`
// Description: An optional description of this cluster.
Description string `json:"description,omitempty"`
// EnableCloudLogging: Whether logs from the cluster should be made
// available via the Google Cloud Logging service. This includes both
// logs from your applications running in the cluster as well as logs
// from the Kubernetes components themselves.
EnableCloudLogging bool `json:"enableCloudLogging,omitempty"`
// Endpoint: [Output only] The IP address of this cluster's Kubernetes
// master. The endpoint can be accessed from the internet at
// https://username:password@endpoint/.
//
// See the masterAuth property of this resource for username and
// password information.
Endpoint string `json:"endpoint,omitempty"`
// MasterAuth: The authentication information for accessing the master.
MasterAuth *MasterAuth `json:"masterAuth,omitempty"`
// Name: The name of this cluster. The name must be unique within this
// project and zone, and can be up to 40 characters with the following
// restrictions:
// - Lowercase letters, numbers, and hyphens only.
// - Must start with a letter.
// - Must end with a number or a letter.
Name string `json:"name,omitempty"`
// Network: The name of the Google Compute Engine network to which the
// cluster is connected.
Network string `json:"network,omitempty"`
// NodeConfig: The machine type and image to use for all nodes in this
// cluster. See the descriptions of the child properties of nodeConfig.
NodeConfig *NodeConfig `json:"nodeConfig,omitempty"`
// NodeRoutingPrefixSize: [Output only] The size of the address space on
// each node for hosting containers.
NodeRoutingPrefixSize int64 `json:"nodeRoutingPrefixSize,omitempty"`
// NumNodes: The number of nodes to create in this cluster. You must
// ensure that your Compute Engine resource quota is sufficient for this
// number of instances plus one (to include the master). You must also
// have available firewall and routes quota.
NumNodes int64 `json:"numNodes,omitempty"`
// SelfLink: [Output only] Server-defined URL for the resource.
SelfLink string `json:"selfLink,omitempty"`
// ServicesIpv4Cidr: [Output only] The IP address range of the
// Kubernetes services in this cluster, in CIDR notation (e.g.
// 1.2.3.4/29). Service addresses are typically put in the last /16 from
// the container CIDR.
ServicesIpv4Cidr string `json:"servicesIpv4Cidr,omitempty"`
// Status: [Output only] The current status of this cluster.
//
// Possible values:
// "error"
// "provisioning"
// "running"
// "stopping"
Status string `json:"status,omitempty"`
// StatusMessage: [Output only] Additional information about the current
// status of this cluster, if available.
StatusMessage string `json:"statusMessage,omitempty"`
// Zone: [Output only] The name of the Google Compute Engine zone in
// which the cluster resides.
Zone string `json:"zone,omitempty"`
}
type CreateClusterRequest struct {
// Cluster: A cluster resource.
Cluster *Cluster `json:"cluster,omitempty"`
}
type ListAggregatedClustersResponse struct {
// Clusters: A list of clusters in the project, across all zones.
Clusters []*Cluster `json:"clusters,omitempty"`
}
type ListAggregatedOperationsResponse struct {
// Operations: A list of operations in the project, across all zones.
Operations []*Operation `json:"operations,omitempty"`
}
type ListClustersResponse struct {
// Clusters: A list of clusters in the project in the specified zone.
Clusters []*Cluster `json:"clusters,omitempty"`
}
type ListOperationsResponse struct {
// Operations: A list of operations in the project in the specified
// zone.
Operations []*Operation `json:"operations,omitempty"`
}
type MasterAuth struct {
// BearerToken: The token used to authenticate API requests to the
// master. The token is to be included in an HTTP Authorization Header
// in all requests to the master endpoint. The format of the header is:
// "Authorization: Bearer ".
BearerToken string `json:"bearerToken,omitempty"`
// Password: The password to use for HTTP basic authentication when
// accessing the Kubernetes master endpoint. Because the master endpoint
// is open to the internet, you should create a strong password.
Password string `json:"password,omitempty"`
// User: The username to use for HTTP basic authentication when
// accessing the Kubernetes master endpoint.
User string `json:"user,omitempty"`
}
type NodeConfig struct {
// MachineType: The name of a Google Compute Engine machine type (e.g.
// n1-standard-1).
//
// If unspecified, the default machine type is n1-standard-1.
MachineType string `json:"machineType,omitempty"`
// ServiceAccounts: The optional list of ServiceAccounts, each with
// their specified scopes, to be made available on all of the node VMs.
// In addition to the service accounts and scopes specified, the
// "default" account will always be created with the following scopes to
// ensure the correct functioning of the cluster:
// - https://www.googleapis.com/auth/compute,
// - https://www.googleapis.com/auth/devstorage.read_only
ServiceAccounts []*ServiceAccount `json:"serviceAccounts,omitempty"`
// SourceImage: The fully-specified name of a Google Compute Engine
// image. For example:
// https://www.googleapis.com/compute/v1/projects/debian-cloud/global/ima
// ges/backports-debian-7-wheezy-vYYYYMMDD (where YYYMMDD is the version
// date).
//
// If specifying an image, you are responsible for ensuring its
// compatibility with the Debian 7 backports image. We recommend leaving
// this field blank to accept the default backports-debian-7-wheezy
// value.
SourceImage string `json:"sourceImage,omitempty"`
}
type Operation struct {
// ErrorMessage: If an error has occurred, a textual description of the
// error.
ErrorMessage string `json:"errorMessage,omitempty"`
// Name: The server-assigned ID for the operation.
Name string `json:"name,omitempty"`
// OperationType: The operation type.
//
// Possible values:
// "createCluster"
// "deleteCluster"
OperationType string `json:"operationType,omitempty"`
// SelfLink: Server-defined URL for the resource.
SelfLink string `json:"selfLink,omitempty"`
// Status: The current status of the operation.
//
// Possible values:
// "done"
// "pending"
// "running"
Status string `json:"status,omitempty"`
// Target: [Optional] The URL of the cluster resource that this
// operation is associated with.
Target string `json:"target,omitempty"`
// TargetLink: Server-defined URL for the target of the operation.
TargetLink string `json:"targetLink,omitempty"`
// Zone: The name of the Google Compute Engine zone in which the
// operation is taking place.
Zone string `json:"zone,omitempty"`
}
type ServiceAccount struct {
// Email: Email address of the service account.
Email string `json:"email,omitempty"`
// Scopes: The list of scopes to be made available for this service
// account.
Scopes []string `json:"scopes,omitempty"`
}
// method id "container.projects.clusters.list":
type ProjectsClustersListCall struct {
s *Service
projectId string
opt_ map[string]interface{}
}
// List: Lists all clusters owned by a project across all zones.
func (r *ProjectsClustersService) List(projectId string) *ProjectsClustersListCall {
c := &ProjectsClustersListCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
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 *ProjectsClustersListCall) Fields(s ...googleapi.Field) *ProjectsClustersListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsClustersListCall) Do() (*ListAggregatedClustersResponse, 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, "{projectId}/clusters")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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 *ListAggregatedClustersResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all clusters owned by a project across all zones.",
// "httpMethod": "GET",
// "id": "container.projects.clusters.list",
// "parameterOrder": [
// "projectId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/clusters",
// "response": {
// "$ref": "ListAggregatedClustersResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.operations.list":
type ProjectsOperationsListCall struct {
s *Service
projectId string
opt_ map[string]interface{}
}
// List: Lists all operations in a project, across all zones.
func (r *ProjectsOperationsService) List(projectId string) *ProjectsOperationsListCall {
c := &ProjectsOperationsListCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
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 *ProjectsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsOperationsListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsOperationsListCall) Do() (*ListAggregatedOperationsResponse, 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, "{projectId}/operations")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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 *ListAggregatedOperationsResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all operations in a project, across all zones.",
// "httpMethod": "GET",
// "id": "container.projects.operations.list",
// "parameterOrder": [
// "projectId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/operations",
// "response": {
// "$ref": "ListAggregatedOperationsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.clusters.create":
type ProjectsZonesClustersCreateCall struct {
s *Service
projectId string
zoneId string
createclusterrequest *CreateClusterRequest
opt_ map[string]interface{}
}
// Create: Creates a cluster, consisting of the specified number and
// type of Google Compute Engine instances, plus a Kubernetes master
// instance.
//
// The cluster is created in the project's default network.
//
// A firewall is added that allows traffic into port 443 on the master,
// which enables HTTPS. A firewall and a route is added for each node to
// allow the containers on that node to communicate with all other
// instances in the cluster.
//
// Finally, an entry is added to the project's global metadata
// indicating which CIDR range is being used by the cluster.
func (r *ProjectsZonesClustersService) Create(projectId string, zoneId string, createclusterrequest *CreateClusterRequest) *ProjectsZonesClustersCreateCall {
c := &ProjectsZonesClustersCreateCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
c.createclusterrequest = createclusterrequest
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 *ProjectsZonesClustersCreateCall) Fields(s ...googleapi.Field) *ProjectsZonesClustersCreateCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesClustersCreateCall) Do() (*Operation, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.createclusterrequest)
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, "{projectId}/zones/{zoneId}/clusters")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
})
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", c.s.userAgent())
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": "Creates a cluster, consisting of the specified number and type of Google Compute Engine instances, plus a Kubernetes master instance.\n\nThe cluster is created in the project's default network.\n\nA firewall is added that allows traffic into port 443 on the master, which enables HTTPS. A firewall and a route is added for each node to allow the containers on that node to communicate with all other instances in the cluster.\n\nFinally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster.",
// "httpMethod": "POST",
// "id": "container.projects.zones.clusters.create",
// "parameterOrder": [
// "projectId",
// "zoneId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone in which the cluster resides.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/clusters",
// "request": {
// "$ref": "CreateClusterRequest"
// },
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.clusters.delete":
type ProjectsZonesClustersDeleteCall struct {
s *Service
projectId string
zoneId string
clusterId string
opt_ map[string]interface{}
}
// Delete: Deletes the cluster, including the Kubernetes master and all
// worker nodes.
//
// Firewalls and routes that were configured at cluster creation are
// also deleted.
func (r *ProjectsZonesClustersService) Delete(projectId string, zoneId string, clusterId string) *ProjectsZonesClustersDeleteCall {
c := &ProjectsZonesClustersDeleteCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
c.clusterId = clusterId
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 *ProjectsZonesClustersDeleteCall) Fields(s ...googleapi.Field) *ProjectsZonesClustersDeleteCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesClustersDeleteCall) 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, "{projectId}/zones/{zoneId}/clusters/{clusterId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
"clusterId": c.clusterId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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": "Deletes the cluster, including the Kubernetes master and all worker nodes.\n\nFirewalls and routes that were configured at cluster creation are also deleted.",
// "httpMethod": "DELETE",
// "id": "container.projects.zones.clusters.delete",
// "parameterOrder": [
// "projectId",
// "zoneId",
// "clusterId"
// ],
// "parameters": {
// "clusterId": {
// "description": "The name of the cluster to delete.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone in which the cluster resides.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/clusters/{clusterId}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.clusters.get":
type ProjectsZonesClustersGetCall struct {
s *Service
projectId string
zoneId string
clusterId string
opt_ map[string]interface{}
}
// Get: Gets a specific cluster.
func (r *ProjectsZonesClustersService) Get(projectId string, zoneId string, clusterId string) *ProjectsZonesClustersGetCall {
c := &ProjectsZonesClustersGetCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
c.clusterId = clusterId
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 *ProjectsZonesClustersGetCall) Fields(s ...googleapi.Field) *ProjectsZonesClustersGetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesClustersGetCall) Do() (*Cluster, 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, "{projectId}/zones/{zoneId}/clusters/{clusterId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
"clusterId": c.clusterId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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 *Cluster
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets a specific cluster.",
// "httpMethod": "GET",
// "id": "container.projects.zones.clusters.get",
// "parameterOrder": [
// "projectId",
// "zoneId",
// "clusterId"
// ],
// "parameters": {
// "clusterId": {
// "description": "The name of the cluster to retrieve.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone in which the cluster resides.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/clusters/{clusterId}",
// "response": {
// "$ref": "Cluster"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.clusters.list":
type ProjectsZonesClustersListCall struct {
s *Service
projectId string
zoneId string
opt_ map[string]interface{}
}
// List: Lists all clusters owned by a project in the specified zone.
func (r *ProjectsZonesClustersService) List(projectId string, zoneId string) *ProjectsZonesClustersListCall {
c := &ProjectsZonesClustersListCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
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 *ProjectsZonesClustersListCall) Fields(s ...googleapi.Field) *ProjectsZonesClustersListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesClustersListCall) Do() (*ListClustersResponse, 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, "{projectId}/zones/{zoneId}/clusters")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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 *ListClustersResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all clusters owned by a project in the specified zone.",
// "httpMethod": "GET",
// "id": "container.projects.zones.clusters.list",
// "parameterOrder": [
// "projectId",
// "zoneId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone in which the cluster resides.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/clusters",
// "response": {
// "$ref": "ListClustersResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.operations.get":
type ProjectsZonesOperationsGetCall struct {
s *Service
projectId string
zoneId string
operationId string
opt_ map[string]interface{}
}
// Get: Gets the specified operation.
func (r *ProjectsZonesOperationsService) Get(projectId string, zoneId string, operationId string) *ProjectsZonesOperationsGetCall {
c := &ProjectsZonesOperationsGetCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
c.operationId = operationId
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 *ProjectsZonesOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsZonesOperationsGetCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesOperationsGetCall) 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, "{projectId}/zones/{zoneId}/operations/{operationId}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
"operationId": c.operationId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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": "Gets the specified operation.",
// "httpMethod": "GET",
// "id": "container.projects.zones.operations.get",
// "parameterOrder": [
// "projectId",
// "zoneId",
// "operationId"
// ],
// "parameters": {
// "operationId": {
// "description": "The server-assigned name of the operation.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone in which the operation resides. This is always the same zone as the cluster with which the operation is associated.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/operations/{operationId}",
// "response": {
// "$ref": "Operation"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
// method id "container.projects.zones.operations.list":
type ProjectsZonesOperationsListCall struct {
s *Service
projectId string
zoneId string
opt_ map[string]interface{}
}
// List: Lists all operations in a project in a specific zone.
func (r *ProjectsZonesOperationsService) List(projectId string, zoneId string) *ProjectsZonesOperationsListCall {
c := &ProjectsZonesOperationsListCall{s: r.s, opt_: make(map[string]interface{})}
c.projectId = projectId
c.zoneId = zoneId
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 *ProjectsZonesOperationsListCall) Fields(s ...googleapi.Field) *ProjectsZonesOperationsListCall {
c.opt_["fields"] = googleapi.CombineFields(s)
return c
}
func (c *ProjectsZonesOperationsListCall) Do() (*ListOperationsResponse, 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, "{projectId}/zones/{zoneId}/operations")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.Expand(req.URL, map[string]string{
"projectId": c.projectId,
"zoneId": c.zoneId,
})
req.Header.Set("User-Agent", c.s.userAgent())
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 *ListOperationsResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists all operations in a project in a specific zone.",
// "httpMethod": "GET",
// "id": "container.projects.zones.operations.list",
// "parameterOrder": [
// "projectId",
// "zoneId"
// ],
// "parameters": {
// "projectId": {
// "description": "The Google Developers Console project ID or project number.",
// "location": "path",
// "required": true,
// "type": "string"
// },
// "zoneId": {
// "description": "The name of the Google Compute Engine zone to return operations for.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "{projectId}/zones/{zoneId}/operations",
// "response": {
// "$ref": "ListOperationsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform"
// ]
// }
}
|