Skip to content

Commit

Permalink
Updating Makefile with upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Dec 22, 2015
1 parent 5c6680d commit f70871b
Show file tree
Hide file tree
Showing 19 changed files with 2,125 additions and 45 deletions.
85 changes: 41 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GENERATED_DIR=$(shell pwd)/generated_python
FINAL_DIR=gcloud_bigtable/_generated
FINAL_DIR=$(shell pwd)/gcloud_bigtable/_generated
GRPC_PLUGIN=grpc_python_plugin
PROTOC_CMD=protoc
PROTOS_DIR=$(shell pwd)/cloud-bigtable-client/bigtable-protos/src/main/proto

help:
@echo 'Makefile for a gcloud-python-bigtable '
Expand All @@ -13,59 +15,54 @@ 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) \
# Generate all *_pb2.py files.
$(PROTOC_CMD) \
--proto_path=$(PROTOS_DIR) \
--plugin=protoc-gen-grpc=$(GRPC_PLUGIN) \
google/bigtable/admin/cluster/v1/*.proto
--python_out=$(GENERATED_DIR) \
--grpc_out=$(GENERATED_DIR) \
$(PROTOS_DIR)/google/bigtable/v1/*.proto \
$(PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto \
$(PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto \
$(PROTOS_DIR)/google/api/*.proto \
$(PROTOS_DIR)/google/protobuf/any.proto \
$(PROTOS_DIR)/google/protobuf/duration.proto \
$(PROTOS_DIR)/google/protobuf/empty.proto \
$(PROTOS_DIR)/google/protobuf/timestamp.proto \
$(PROTOS_DIR)/google/longrunning/operations.proto \
$(PROTOS_DIR)/google/rpc/status.proto
# Move the newly generated *_pb2.py files into our library.
mv $(GENERATED_DIR)/google/bigtable/v1/* $(FINAL_DIR)
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)
# Remove all existing *.proto files before we replace
rm -f $(FINAL_DIR)/*.proto
# Copy over the *.proto files into our library.
cp $(PROTOS_DIR)/google/bigtable/v1/*.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/bigtable/admin/cluster/v1/*.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/bigtable/admin/table/v1/*.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/api/*.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/protobuf/any.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/protobuf/duration.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/protobuf/empty.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/protobuf/timestamp.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/longrunning/operations.proto $(FINAL_DIR)
cp $(PROTOS_DIR)/google/rpc/status.proto $(FINAL_DIR)
# Rename all *.proto files in our library with an
# underscore and remove executable bit.
cd $(FINAL_DIR) && \
for filename in *.proto; do \
chmod -x $$filename ; \
mv $$filename _$$filename ; \
done
# Rewrite the imports in the generated *_pb2.py files.
python scripts/rewrite_imports.py

check_generate:
Expand Down
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;
}

0 comments on commit f70871b

Please sign in to comment.