Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bigtable generated files #1152

Merged
merged 4 commits into from
Sep 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
omit =
*/demo/*
*/demo.py
*/_generated/*.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ pylintrc_reduced

# Travis build directories.
gcloud-python-wheels/

# Directories used for creating generated PB2 files
generated_python/
cloud-bigtable-client/
79 changes: 79 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
GENERATED_DIR=$(shell pwd)/generated_python
FINAL_DIR=gcloud/bigtable/_generated
BREW_PREFIX=$(shell brew --prefix)
LD_LIBRARY_PATH=$(BREW_PREFIX)/lib
GRPC_PLUGIN=$(BREW_PREFIX)/bin/grpc_python_plugin

help:
@echo 'Makefile for gcloud-python Bigtable protos '
@echo ' '
@echo ' make generate Generates the protobuf modules '
@echo ' make check_generate Checks that generate succeeded '
@echo ' make clean Clean generated files '

generate:
[ -d cloud-bigtable-client ] || git clone https://github.com/GoogleCloudPlatform/cloud-bigtable-client
cd cloud-bigtable-client && git pull origin master
mkdir -p $(GENERATED_DIR)
# Data API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) google/bigtable/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/v1/* $(FINAL_DIR)
# Cluster API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/bigtable/admin/cluster/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/admin/cluster/v1/* $(FINAL_DIR)
# Table API
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/bigtable/admin/table/v1/*.proto
mv $(GENERATED_DIR)/google/bigtable/admin/table/v1/* $(FINAL_DIR)
# Auxiliary protos
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/api/*.proto
mv $(GENERATED_DIR)/google/api/* $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/any.proto
mv $(GENERATED_DIR)/google/protobuf/any_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/duration.proto
mv $(GENERATED_DIR)/google/protobuf/duration_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/empty.proto
mv $(GENERATED_DIR)/google/protobuf/empty_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/protobuf/timestamp.proto
mv $(GENERATED_DIR)/google/protobuf/timestamp_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/longrunning/operations.proto
mv $(GENERATED_DIR)/google/longrunning/operations_pb2.py $(FINAL_DIR)
cd cloud-bigtable-client/bigtable-protos/src/main/proto && \
protoc --python_out=$(GENERATED_DIR) --grpc_out=$(GENERATED_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/rpc/status.proto
mv $(GENERATED_DIR)/google/rpc/status_pb2.py $(FINAL_DIR)
python scripts/rewrite_imports.py

check_generate:
python scripts/check_generate.py

clean:
rm -fr cloud-bigtable-client $(GENERATED_DIR)

.PHONY: generate check_generate clean
15 changes: 15 additions & 0 deletions gcloud/bigtable/_generated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Generated protobuf modules for Google Cloud Bigtable API."""
29 changes: 29 additions & 0 deletions gcloud/bigtable/_generated/_annotations.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.api;

import "google/api/http.proto";
import "google/protobuf/descriptor.proto";

option java_multiple_files = true;
option java_outer_classname = "AnnotationsProto";
option java_package = "com.google.api";

extend google.protobuf.MethodOptions {
// See `HttpRule`.
HttpRule http = 72295728;
}
87 changes: 87 additions & 0 deletions gcloud/bigtable/_generated/_any.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.protobuf;

option java_generate_equals_and_hash = true;
option java_multiple_files = true;
option java_outer_classname = "AnyProto";
option java_package = "com.google.protobuf";


// `Any` contains an arbitrary serialized message along with a URL
// that describes the type of the serialized message.
//
// The proto runtimes and/or compiler will eventually
// provide utilities to pack/unpack Any values (projected Q1/15).
//
// # JSON
// The JSON representation of an `Any` value uses the regular
// representation of the deserialized, embedded message, with an
// additional field `@type` which contains the type URL. Example:
//
// package google.profile;
// message Person {
// string first_name = 1;
// string last_name = 2;
// }
//
// {
// "@type": "type.googleapis.com/google.profile.Person",
// "firstName": <string>,
// "lastName": <string>
// }
//
// If the embedded message type is well-known and has a custom JSON
// representation, that representation will be embedded adding a field
// `value` which holds the custom JSON in addition to the the `@type`
// field. Example (for message [google.protobuf.Duration][google.protobuf.Duration]):
//
// {
// "@type": "type.googleapis.com/google.protobuf.Duration",
// "value": "1.212s"
// }
//
message Any {
// A URL/resource name whose content describes the type of the
// serialized message.
//
// For URLs which use the schema `http`, `https`, or no schema, the
// following restrictions and interpretations apply:
//
// * If no schema is provided, `https` is assumed.
// * The last segment of the URL's path must represent the fully
// qualified name of the type (as in `path/google.protobuf.Duration`).
// * An HTTP GET on the URL must yield a [google.protobuf.Type][google.protobuf.Type]
// value in binary format, or produce an error.
// * Applications are allowed to cache lookup results based on the
// URL, or have them precompiled into a binary to avoid any
// lookup. Therefore, binary compatibility needs to be preserved
// on changes to types. (Use versioned type names to manage
// breaking changes.)
//
// Schemas other than `http`, `https` (or the empty schema) might be
// used with implementation specific semantics.
//
// Types originating from the `google.*` package
// namespace should use `type.googleapis.com/full.type.name` (without
// schema and path). A type service will eventually become available which
// serves those URLs (projected Q2/15).
string type_url = 1;

// Must be valid serialized data of the above specified type.
bytes value = 2;
}
94 changes: 94 additions & 0 deletions gcloud/bigtable/_generated/_bigtable_cluster_data.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Copyright (c) 2015, Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.bigtable.admin.cluster.v1;

import "google/api/annotations.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/timestamp.proto";

option java_multiple_files = true;
option java_outer_classname = "BigtableClusterDataProto";
option java_package = "com.google.bigtable.admin.cluster.v1";


// A physical location in which a particular project can allocate Cloud BigTable
// resources.
message Zone {
// Possible states of a zone.
enum Status {
// The state of the zone is unknown or unspecified.
UNKNOWN = 0;

// The zone is in a good state.
OK = 1;

// The zone is down for planned maintenance.
PLANNED_MAINTENANCE = 2;

// The zone is down for emergency or unplanned maintenance.
EMERGENCY_MAINENANCE = 3;
}

// A permanent unique identifier for the zone.
// Values are of the form projects/<project>/zones/[a-z][-a-z0-9]*
string name = 1;

// The name of this zone as it appears in UIs.
string display_name = 2;

// The current state of this zone.
Status status = 3;
}

// An isolated set of Cloud BigTable resources on which tables can be hosted.
message Cluster {
// A permanent unique identifier for the cluster. For technical reasons, the
// zone in which the cluster resides is included here.
// Values are of the form
// projects/<project>/zones/<zone>/clusters/[a-z][-a-z0-9]*
string name = 1;

// If this cluster has been deleted, the time at which its backup will
// be irrevocably destroyed. Omitted otherwise.
// This cannot be set directly, only through DeleteCluster.
google.protobuf.Timestamp delete_time = 2;

// The operation currently running on the cluster, if any.
// This cannot be set directly, only through CreateCluster, UpdateCluster,
// or UndeleteCluster. Calls to these methods will be rejected if
// "current_operation" is already set.
google.longrunning.Operation current_operation = 3;

// The descriptive name for this cluster as it appears in UIs.
// Must be unique per zone.
string display_name = 4;

// The number of serve nodes allocated to this cluster.
int32 serve_nodes = 5;

// What storage type to use for tables in this cluster. Only configurable at
// cluster creation time. If unspecified, STORAGE_SSD will be used.
StorageType default_storage_type = 8;
}

enum StorageType {
// The storage type used is unspecified.
STORAGE_UNSPECIFIED = 0;

// Data will be stored in SSD, providing low and consistent latencies.
STORAGE_SSD = 1;
}
Loading