├── app-engine-metadata ├── CONTRIBUTORS ├── README.md ├── app.yaml ├── app.go └── LICENSE ├── README.md ├── google-cloud-datastore └── interactive-demo │ ├── requirements.txt │ ├── .gitignore │ ├── WEB-INF │ ├── datastore-indexes.xml │ ├── appengine-web.xml │ └── web.xml │ ├── README.md │ ├── demo.py │ └── code.py ├── cloud-vision-nodejs ├── .gitignore ├── README.md ├── package.json ├── index.js └── LICENSE ├── grpc-kubernetes-microservices ├── part1 │ ├── frontend-container │ │ ├── Dockerfile │ │ ├── package.json │ │ └── frontend.js │ ├── frontend-service.yaml │ ├── frontend-controller.yaml │ └── demo_pt1.sh └── part2 │ ├── backend-container │ ├── Dockerfile │ ├── interface.proto │ ├── package.json │ └── backend.js │ ├── frontend-container │ ├── Dockerfile │ ├── interface.proto │ ├── package.json │ └── frontend.js │ ├── backend-service.yaml │ ├── backend-controller.yaml │ ├── frontend-controller.yaml │ └── demo_pt2.sh └── LICENSE /app-engine-metadata/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | Sandeep Dinesh 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # samples 2 | General repo for Samples and Examples I make 3 | -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/requirements.txt: -------------------------------------------------------------------------------- 1 | setuptools 2 | gcloud 3 | code -------------------------------------------------------------------------------- /cloud-vision-nodejs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | uploads 3 | key.json 4 | npm-debug.log 5 | -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/.gitignore: -------------------------------------------------------------------------------- 1 | key.json 2 | .DS_Store 3 | code.pyc 4 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/frontend-container/Dockerfile: -------------------------------------------------------------------------------- 1 | from node:0.12.7-onbuild -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grpc/node:0.10-onbuild 2 | EXPOSE 3000 -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/frontend-container/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM grpc/node:0.10-onbuild 2 | EXPOSE 3000 -------------------------------------------------------------------------------- /cloud-vision-nodejs/README.md: -------------------------------------------------------------------------------- 1 | #Google Cloud Vision API with Node.js 2 | 3 | This is a example of using the Cloud Vision API with Node.js -------------------------------------------------------------------------------- /app-engine-metadata/README.md: -------------------------------------------------------------------------------- 1 | App Engine example to access project metadata. 2 | 3 | Replace YOUR-GOOGLE-PROJECT-ID-HERE in app.yaml with your project id 4 | 5 | To add/update metadata, run the following gcloud command 6 | 7 | ``` 8 | $ gcloud compute project-info add-metadata --metadata = 9 | ``` 10 | -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/WEB-INF/datastore-indexes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/frontend-container/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-client-1", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "Part One of Microservices Demo using Kubernetes and gRPC", 6 | "scripts": { 7 | "start": "node frontend.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "" 12 | }, 13 | "license": "Apache-2.0" 14 | } -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-container/interface.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package geo; 4 | 5 | service GeoService { 6 | rpc DistanceBetween (Points) returns (Distance) {} 7 | } 8 | 9 | message Point { 10 | float lat = 1; 11 | float lng = 2; 12 | } 13 | 14 | message Points { 15 | Point origin = 1; 16 | Point destination = 2; 17 | } 18 | 19 | message Distance { 20 | float distance = 1; 21 | } -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/frontend-container/interface.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package geo; 4 | 5 | service GeoService { 6 | rpc DistanceBetween (Points) returns (Distance) {} 7 | } 8 | 9 | message Point { 10 | float lat = 1; 11 | float lng = 2; 12 | } 13 | 14 | message Points { 15 | Point origin = 1; 16 | Point destination = 2; 17 | } 18 | 19 | message Distance { 20 | float distance = 1; 21 | } -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-container/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-backend", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "Part Two of Microservices Demo using Kubernetes and gRPC", 6 | "scripts": { 7 | "start": "node backend.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "" 12 | }, 13 | "dependencies": { 14 | "grpc": "~0.10.0" 15 | }, 16 | "license": "Apache-2.0" 17 | } -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/frontend-container/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-client-2", 3 | "version": "1.0.0", 4 | "private": true, 5 | "description": "Part Two of Microservices Demo using Kubernetes and gRPC", 6 | "scripts": { 7 | "start": "node frontend.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "" 12 | }, 13 | "dependencies": { 14 | "grpc": "~0.10.0" 15 | }, 16 | "license": "Apache-2.0" 17 | } -------------------------------------------------------------------------------- /cloud-vision-nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cloud-vision-nodejs", 3 | "version": "1.0.0", 4 | "description": "example of using the Cloud Vision API with Node.js", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "Sandeep Dinesh", 10 | "dependencies": { 11 | "express": "^4.13.4", 12 | "gcloud": "^0.30.2", 13 | "mime": "^1.3.4", 14 | "multer": "^1.1.0" 15 | }, 16 | "license": "Apache-2.0" 17 | } 18 | -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/WEB-INF/appengine-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | YOUR_PROJECT_ID_HERE 4 | 1 5 | 6 | true 7 | true 8 | true 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-engine-metadata/app.yaml: -------------------------------------------------------------------------------- 1 | #Copyright 2015 Google Inc. All Rights Reserved. 2 | # 3 | #Licensed under the Apache License, Version 2.0 (the "License"); 4 | #you may not use this file except in compliance with the License. 5 | #You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | #Unless required by applicable law or agreed to in writing, software 10 | #distributed under the License is distributed on an "AS IS" BASIS, 11 | #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | #See the License for the specific language governing permissions and 13 | #limitations under the License. 14 | application: YOUR-GOOGLE-PROJECT-ID-HERE 15 | version: 1 16 | runtime: go 17 | api_version: go1 18 | 19 | handlers: 20 | - url: /.* 21 | script: _go_app 22 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-service.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | apiVersion: v1 15 | kind: Service 16 | metadata: 17 | name: backend 18 | labels: 19 | name: backend 20 | spec: 21 | ports: 22 | - port: 50051 23 | targetPort: 50051 24 | selector: 25 | name: backend -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/frontend-container/frontend.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015, Google, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | var http = require('http'); 16 | var server = http.createServer(function (request, response) { 17 | response.writeHead(200, {"Content-Type": "text/plain"}); 18 | response.end("Hello World\n"); 19 | }); 20 | server.listen(3000); -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/frontend-service.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | apiVersion: v1 15 | kind: Service 16 | metadata: 17 | name: frontend 18 | labels: 19 | name: frontend 20 | spec: 21 | type: LoadBalancer 22 | ports: 23 | - port: 80 24 | targetPort: 3000 25 | protocol: TCP 26 | selector: 27 | name: frontend -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | index.html 6 | 7 | 8 | 9 | 10 | /datastore/* 11 | 12 | 13 | CONFIDENTIAL 14 | 15 | 16 | 17 | 18 | DatastoreApiServlet 19 | 20 | com.google.apphosting.client.datastoreservice.app.DatastoreApiServlet 21 | 22 | 1 23 | 24 | 25 | 26 | DatastoreApiServlet 27 | /datastore/* 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-controller.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | apiVersion: extensions/v1beta1 15 | kind: Deployment 16 | metadata: 17 | name: backend 18 | spec: 19 | replicas: 4 20 | template: 21 | metadata: 22 | labels: 23 | name: backend 24 | spec: 25 | containers: 26 | - image: gcr.io/smart-spark-93622/backend:1.0 27 | name: backend 28 | ports: 29 | - containerPort: 50051 30 | name: backend -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/frontend-controller.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | apiVersion: extensions/v1beta1 15 | kind: Deployment 16 | metadata: 17 | name: frontend 18 | spec: 19 | replicas: 2 20 | template: 21 | metadata: 22 | labels: 23 | name: frontend 24 | spec: 25 | containers: 26 | - image: gcr.io/smart-spark-93622/frontend:1.0 27 | name: frontend 28 | ports: 29 | - containerPort: 3000 30 | name: http-server -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/frontend-controller.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | apiVersion: extensions/v1beta1 15 | kind: Deployment 16 | metadata: 17 | name: frontend 18 | spec: 19 | replicas: 2 20 | template: 21 | metadata: 22 | labels: 23 | name: frontend 24 | spec: 25 | containers: 26 | - image: gcr.io/smart-spark-93622/frontend:2.0 27 | name: frontend 28 | ports: 29 | - containerPort: 3000 30 | name: http-server -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/README.md: -------------------------------------------------------------------------------- 1 | This is a sample to demonstrate Google Cloud Datastore with the python gcloud library. 2 | 3 | Usage Video: https://youtu.be/bMC_k0NBjKs?t=1508 4 | 5 | #Prerequisites: 6 | 7 | 1) Java 7 Runtime (or later version) http://java.com/ 8 | 2) gcd tool https://cloud.google.com/datastore/docs/downloads#tools 9 | 3) Python 2.7 10 | 4) pip 11 | 5) Account on Google Cloud Platform https://cloud.google.com/ 12 | 13 | 14 | #Steps: 15 | 16 | 1) Log in to Google Cloud Platform https://console.developers.google.com/ 17 | 2) Create a project 18 | 3) Enable Google Cloud Datastore API 19 | 4) Create a new client key (Credentials > Create new Client ID > Service Account) 20 | 5) Never share your private key! 21 | 6) Rename the JSON key you downloaded to key.json and move it to the project directory 22 | 7) Replace YOUR_RPOEJCT_ID_HERE in code.py to your Google Cloud Project ID 23 | 8) Replace YOUR_RPOEJCT_ID_HERE in appengine-web.xml to your Google Cloud Project ID 24 | 9) Run the gcd tool to create the indexes (this will take some time, you can check progress in the developers console) 25 | Linux/OSX/Unix: path/to/gcd.sh updateindexes --auth_mode=oauth2 . 26 | Windows: path/to/gcd.cmd updateindexes --auth_mode=oauth2 . 27 | 10) Install python libraies: pip install -r requirements.txt 28 | 11) Run: 29 | python demo.py 30 | to start the program! 31 | 32 | Notes: 33 | This is not an official Google product. -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/backend-container/backend.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015, Google, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | var url = require('url'); 16 | var grpc = require('grpc'); 17 | 18 | var proto = grpc.load('interface.proto'); 19 | 20 | var GeoService = grpc.buildServer([proto.geo.GeoService.service]); 21 | 22 | var server = new GeoService({ 23 | 'geo.GeoService': { 24 | distanceBetween: function(call, callback) { 25 | callback(null, getDistance(call.request)); 26 | } 27 | } 28 | }); 29 | 30 | function getDistance(points){ 31 | return distance(points.origin.lat, points.origin.lng, points.destination.lat, points.destination.lng); 32 | } 33 | 34 | server.bind('0.0.0.0:50051'); 35 | server.listen(); 36 | 37 | 38 | // From http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points 39 | // User: Salvador Dali - http://stackoverflow.com/users/1090562/salvador-dali 40 | function distance(lat1,lon1,lat2,lon2) { 41 | var R = 6371; // Radius of the earth in km 42 | var a = 43 | 0.5 - Math.cos((lat2 - lat1) * Math.PI / 180)/2 + 44 | Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * 45 | (1 - Math.cos((lon2 - lon1) * Math.PI / 180))/2; 46 | return R * 2 * Math.asin(Math.sqrt(a)); 47 | } 48 | //////////////////////////////////// -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/frontend-container/frontend.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015, Google, Inc. 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | */ 15 | var url = require('url'); 16 | var grpc = require('grpc'); 17 | 18 | var proto = grpc.load('interface.proto'); 19 | 20 | var client = new proto.geo.GeoService('backend:50051'); 21 | 22 | function getDistance(response, query) { 23 | 24 | console.log(query); 25 | 26 | var lat1 = parseFloat((query.lat1) ? query.lat1 : 0); 27 | var lng1 = parseFloat((query.lng1) ? query.lng1 : 0); 28 | 29 | var lat2 = parseFloat((query.lat2) ? query.lat2 : 15); 30 | var lng2 = parseFloat((query.lng2) ? query.lng2 : 15); 31 | 32 | var request = { 33 | origin: { 34 | lat: lat1, 35 | lng: lng1 36 | }, 37 | destination: { 38 | lat: lat2, 39 | lng: lng2 40 | }, 41 | } 42 | 43 | client.distanceBetween(request, function(error, distance) { 44 | if (error) { 45 | response.end(JSON.stringify(error)); 46 | } else { 47 | response.end("Distance = " + JSON.stringify(distance) + "\n"); 48 | } 49 | }); 50 | } 51 | 52 | var http = require('http'); 53 | var server = http.createServer(function(request, response) { 54 | response.writeHead(200, { 55 | "Content-Type": "text/plain" 56 | }); 57 | getDistance(response, url.parse(request.url, true).query); 58 | }); 59 | server.listen(3000); 60 | -------------------------------------------------------------------------------- /app-engine-metadata/app.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2015 Google Inc. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package metadata_sample is an App Engine app that fetches project metadata. 18 | package metadata_sample 19 | 20 | import ( 21 | "encoding/json" 22 | "fmt" 23 | "net/http" 24 | 25 | "golang.org/x/net/context" 26 | "golang.org/x/oauth2/google" 27 | 28 | "google.golang.org/api/compute/v1" 29 | 30 | "google.golang.org/appengine" 31 | "google.golang.org/appengine/log" 32 | ) 33 | 34 | func init() { 35 | http.HandleFunc("/", handler) 36 | } 37 | 38 | func handler(w http.ResponseWriter, r *http.Request) { 39 | ctx := appengine.NewContext(r) 40 | 41 | // Get and Print out the metadata 42 | metadata, err := getMetadata(ctx) 43 | if err != nil { 44 | msg := fmt.Sprintf("Could not get metadata: %v", err) 45 | log.Errorf(ctx, "%s", msg) 46 | http.Error(w, msg, 500) 47 | return 48 | } 49 | json.NewEncoder(w).Encode(metadata) 50 | } 51 | 52 | // getMetadata fetches Project Metadata from the project that this App Engine program is running in. 53 | func getMetadata(ctx context.Context) (map[string]string, error) { 54 | // Get the OAuth Credentials for the Compute Engine scope 55 | hc, err := google.DefaultClient(ctx, compute.ComputeScope) 56 | 57 | // Connect to the Compute Engine service 58 | service, err := compute.New(hc) 59 | if err != nil { 60 | return nil, err 61 | } 62 | 63 | // Get the project 64 | proj, err := service.Projects.Get(appengine.AppID(ctx)).Do() 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | // Convert metadata to a nice map 70 | meta := make(map[string]string) 71 | for _, item := range proj.CommonInstanceMetadata.Items { 72 | if item.Value == nil { 73 | continue 74 | } 75 | meta[item.Key] = *item.Value 76 | } 77 | 78 | return meta, nil 79 | } 80 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part2/demo_pt2.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | #!/bin/bash 15 | PROJECTID=$(gcloud config list project | awk 'FNR ==2 { print $3 }') 16 | 17 | docker rmi -f api-world/frontend:2.0 18 | docker rmi -f gcr.io/$PROJECTID/frontend:2.0 19 | docker rmi -f api-world/backend:1.0 20 | docker rmi -f gcr.io/$PROJECTID/backend:1.0 21 | 22 | clear 23 | 24 | printf "\n IMPORTANT: Part 1 Must be run first! \n" 25 | 26 | printf "\n\n Build Containers \n" 27 | 28 | cat << EOM 29 | docker build -t api-world/frontend:2.0 ./frontend-container/ 30 | EOM 31 | 32 | docker build -t api-world/frontend:2.0 ./frontend-container/ 33 | 34 | cat << EOM 35 | docker build -t api-world/backend:1.0 ./backend-container/ 36 | EOM 37 | 38 | docker build -t api-world/backend:1.0 ./backend-container/ 39 | 40 | printf "\n\n Publish Containers \n" 41 | 42 | cat << EOM 43 | docker tag api-world/frontend:2.0 gcr.io/$PROJECTID/frontend:2.0 44 | gcloud docker push gcr.io/$PROJECTID/frontend:2.0 45 | EOM 46 | 47 | docker tag api-world/frontend:2.0 gcr.io/$PROJECTID/frontend:2.0 48 | gcloud docker push gcr.io/$PROJECTID/frontend:2.0 49 | 50 | cat << EOM 51 | docker tag api-world/backend:1.0 gcr.io/$PROJECTID/backend:1.0 52 | gcloud docker push gcr.io/$PROJECTID/backend:1.0 53 | EOM 54 | 55 | docker tag api-world/backend:1.0 gcr.io/$PROJECTID/backend:1.0 56 | gcloud docker push gcr.io/$PROJECTID/backend:1.0 57 | 58 | printf "\n\n Create Backend Controller \n" 59 | 60 | cat << EOM 61 | 62 | kubectl create -f backend-controller.yaml 63 | EOM 64 | 65 | kubectl create -f backend-controller.yaml 66 | 67 | printf "\n\n Create Backend Service \n" 68 | 69 | cat << EOM 70 | 71 | kubectl create -f backend-service.yaml 72 | EOM 73 | 74 | kubectl create -f backend-service.yaml 75 | 76 | printf "\n\n Update Frontend \n" 77 | 78 | cat << EOM 79 | kubectl apply -f frontend-controller.yaml 80 | 81 | EOM 82 | 83 | kubectl apply -f frontend-controller.yaml -------------------------------------------------------------------------------- /cloud-vision-nodejs/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Google Inc. All Rights Reserved. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | 'use strict'; 18 | 19 | var express = require('express'); 20 | var fs = require('fs'); 21 | var util = require('util'); 22 | var mime = require('mime'); 23 | var multer = require('multer'); 24 | var upload = multer({dest: 'uploads/'}); 25 | 26 | // Set up auth 27 | var gcloud = require('gcloud')({ 28 | keyFilename: 'key.json', 29 | projectId: '' 30 | }); 31 | 32 | var vision = gcloud.vision(); 33 | 34 | var app = express(); 35 | 36 | // Simple upload form 37 | var form = '' + 38 | "
" + 39 | "" + 40 | "
" + 41 | ''; 42 | 43 | app.get('/', function(req, res) { 44 | res.writeHead(200, { 45 | 'Content-Type': 'text/html' 46 | }); 47 | res.end(form); 48 | }); 49 | 50 | // Get the uploaded image 51 | // Image is uploaded to req.file.path 52 | app.post('/upload', upload.single('image'), function(req, res, next) { 53 | 54 | // Choose what the Vision API should detect 55 | // Choices are: faces, landmarks, labels, logos, properties, safeSearch, texts 56 | var types = ['labels']; 57 | 58 | // Send the image to the Cloud Vision API 59 | vision.detect(req.file.path, types, function(err, detections, apiResponse) { 60 | if (err) { 61 | res.end('Cloud Vision Error'); 62 | } else { 63 | res.writeHead(200, { 64 | 'Content-Type': 'text/html' 65 | }); 66 | res.write(''); 67 | 68 | // Base64 the image so we can display it on the page 69 | res.write('
'); 70 | 71 | // Write out the JSON output of the Vision API 72 | res.write(JSON.stringify(detections, null, 4)); 73 | 74 | // Delete file (optional) 75 | fs.unlinkSync(req.file.path); 76 | 77 | res.end(''); 78 | } 79 | }); 80 | }); 81 | 82 | app.listen(8080); 83 | console.log('Server Started'); 84 | 85 | // Turn image into Base64 so we can display it easily 86 | 87 | function base64Image(src) { 88 | var data = fs.readFileSync(src).toString('base64'); 89 | return util.format('data:%s;base64,%s', mime.lookup(src), data); 90 | } 91 | -------------------------------------------------------------------------------- /grpc-kubernetes-microservices/part1/demo_pt1.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http://www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | # 14 | #!/bin/bash 15 | 16 | PROJECTID=$(gcloud config list project | awk 'FNR ==2 { print $3 }') 17 | 18 | docker rmi -f api-world/frontend:1.0 19 | docker rmi -f gcr.io/$PROJECTID/frontend:1.0 20 | 21 | clear 22 | 23 | printf "\n Creating Cluster \n" 24 | 25 | cat << EOM 26 | gcloud container --project "$PROJECTID" 27 | clusters create "api-world-cluster" 28 | --zone "us-central1-f" 29 | --machine-type "n1-standard-1" 30 | --num-nodes "3" 31 | --scope "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring" 32 | EOM 33 | 34 | gcloud container --project "$PROJECTID" \ 35 | clusters create "api-world-cluster" \ 36 | --zone "us-central1-f" \ 37 | --machine-type "n1-standard-1" \ 38 | --num-nodes "3" \ 39 | --scope "https://www.googleapis.com/auth/compute","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring" 40 | 41 | printf "\n\n Logging into Cluster \n" 42 | 43 | cat << EOM 44 | gcloud container clusters get-credentials api-world-cluster 45 | --project "$PROJECTID" 46 | --zone "us-central1-f" 47 | EOM 48 | 49 | gcloud container clusters get-credentials api-world-cluster \ 50 | --project "$PROJECTID" \ 51 | --zone "us-central1-f" 52 | 53 | printf "\n\n Build Container \n" 54 | 55 | cat << EOM 56 | docker build -t api-world/frontend:1.0 ./frontend-container/ 57 | EOM 58 | 59 | docker build -t api-world/frontend:1.0 ./frontend-container/ 60 | 61 | printf "\n\n Publish Container \n" 62 | 63 | cat << EOM 64 | docker tag api-world/frontend:1.0 gcr.io/$PROJECTID/frontend:1.0 65 | gcloud docker push gcr.io/$PROJECTID/frontend:1.0 66 | EOM 67 | 68 | docker tag api-world/frontend:1.0 gcr.io/$PROJECTID/frontend:1.0 69 | gcloud docker push gcr.io/$PROJECTID/frontend:1.0 70 | 71 | printf "\n\n Create Controller \n" 72 | 73 | cat << EOM 74 | 75 | kubectl apply -f frontend-controller.yaml 76 | EOM 77 | 78 | kubectl apply -f frontend-controller.yaml 79 | 80 | printf "\n\n Create Service \n" 81 | 82 | cat << EOM 83 | 84 | kubectl apply -f frontend-service.yaml 85 | EOM 86 | 87 | kubectl apply -f frontend-service.yaml 88 | 89 | printf "\n\n Get IP Address \n" 90 | 91 | cat << EOM 92 | kubectl get services 93 | 94 | EOM 95 | 96 | sleep 30 97 | kubectl get services 98 | -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/demo.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, Google, Inc. 2 | # Licensed under the Apache License, Version 2.0 (the "License"); 3 | # you may not use this file except in compliance with the License. 4 | # You may obtain a copy of the License at 5 | # 6 | # http:#www.apache.org/licenses/LICENSE-2.0 7 | # 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | # Copyright 2014 Google Inc. All rights reserved. 15 | # 16 | # Licensed under the Apache License, Version 2.0 (the "License"); 17 | # you may not use this file except in compliance with the License. 18 | # You may obtain a copy of the License at 19 | # 20 | # http://www.apache.org/licenses/LICENSE-2.0 21 | # 22 | # Unless required by applicable law or agreed to in writing, software 23 | # distributed under the License is distributed on an "AS IS" BASIS, 24 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | # See the License for the specific language governing permissions and 26 | # limitations under the License. 27 | 28 | # pragma NO COVER 29 | import itertools 30 | import os.path 31 | import sys 32 | import time 33 | from six.moves import input 34 | 35 | class DemoRunner(object): 36 | """An interactive runner of demo scripts.""" 37 | 38 | KEYPRESS_DELAY = 0.01 39 | GLOBALS, LOCALS = globals(), locals() 40 | CODE, COMMENT = 'code', 'comment' 41 | 42 | def __init__(self, fp): 43 | self.lines = [line.rstrip() for line in fp.readlines()] 44 | 45 | @classmethod 46 | def from_module(cls, module): 47 | path = os.path.join(os.path.dirname(module.__file__), 48 | 'demo', 'demo.py') 49 | 50 | return cls(open(path, 'r')) 51 | 52 | def run(self): 53 | line_groups = itertools.groupby(self.lines, self.get_line_type) 54 | 55 | newline = False # Don't use newline on the first statement. 56 | for group_type, lines in line_groups: 57 | if group_type == self.COMMENT: 58 | self.write(lines, newline=newline) 59 | newline = True 60 | 61 | elif group_type == self.CODE: 62 | self.code(lines) 63 | 64 | #interact('(Hit CTRL-D to exit...)', local=self.LOCALS) 65 | 66 | def wait(self): 67 | input() 68 | 69 | @classmethod 70 | def get_line_type(cls, line): 71 | if line.startswith('#'): 72 | return cls.COMMENT 73 | else: 74 | return cls.CODE 75 | 76 | def get_indent_level(self, line): 77 | if not line.strip(): 78 | return None 79 | return len(line) - len(line.lstrip()) 80 | 81 | def _print(self, text='', newline=True): 82 | sys.stdout.write(text) 83 | if newline: 84 | sys.stdout.write('\n') 85 | 86 | def write(self, lines, newline=True): 87 | self._print(newline=newline) 88 | self._print('\n'.join(lines), False) 89 | self.wait() 90 | 91 | def code(self, lines): 92 | code_lines = [] 93 | 94 | for line in lines: 95 | indent = self.get_indent_level(line) 96 | 97 | # If we've completed a block, 98 | # run whatever code was built up in code_lines. 99 | if indent == 0: 100 | self._execute_lines(code_lines) 101 | code_lines = [] 102 | 103 | # Print the prefix for the line depending on the indentation level. 104 | if indent == 0: 105 | self._print('>>> ', False) 106 | elif indent > 0: 107 | self._print('\n... ', False) 108 | elif indent is None: 109 | continue 110 | 111 | # Break the line into the code section and the comment section. 112 | if '#' in line: 113 | code, comment = line.split('#', 2) 114 | else: 115 | code, comment = line, None 116 | 117 | # 'Type' out the comment section. 118 | for char in code.rstrip(): 119 | time.sleep(self.KEYPRESS_DELAY) 120 | sys.stdout.write(char) 121 | sys.stdout.flush() 122 | 123 | # Print the comment section (not typed out). 124 | if comment: 125 | sys.stdout.write(' # %s' % comment.strip()) 126 | 127 | # Add the current line to the list of lines to be run 128 | # in this block. 129 | code_lines.append(line) 130 | 131 | # If we had any code built up that wasn't part of a completed block 132 | # (ie, the lines ended with an indented line), 133 | # run that code. 134 | if code_lines: 135 | self._execute_lines(code_lines) 136 | 137 | def _execute_lines(self, lines): 138 | if lines: 139 | self.wait() 140 | 141 | # Yes, this is crazy unsafe... but it's demo code. 142 | exec('\n'.join(lines), self.GLOBALS, self.LOCALS) 143 | 144 | if __name__ == "__main__": 145 | fp = open("code.py") 146 | demo = DemoRunner(fp) 147 | demo.run() 148 | fp.close() -------------------------------------------------------------------------------- /google-cloud-datastore/interactive-demo/code.py: -------------------------------------------------------------------------------- 1 | # Welcome to the Datastore Demo! (hit enter) 2 | # We're going to walk through some of the basics... 3 | # Don't worry though. You don't need to do anything, just keep hitting enter... 4 | 5 | # Copyright 2015, Google, Inc. 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http:#www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | #Import libraries 19 | from gcloud import datastore 20 | import datetime 21 | 22 | #The next few lines will set up your connection to Datastore 23 | #Replace "YOUR_RPOEJCT_ID_HERE" with the correct value in code.py 24 | projectID = "smart-spark-93622" 25 | 26 | client = datastore.Client.from_service_account_json( json_credentials_path="key.json", dataset_id=projectID ) 27 | 28 | record_key = client.key('Record', 1234) 29 | record_entity = datastore.Entity(key=record_key,exclude_from_indexes=('RandomFieldName',)) 30 | 31 | embedded_key = client.key('Data', 2345) 32 | embedded_entity = datastore.Entity(key=embedded_key,exclude_from_indexes=('big_field',)) 33 | embedded_entity['field1']='1234' 34 | with open ("code.py", "r") as myfile: 35 | embedded_entity['big_field']=myfile.read().replace('\n', '') 36 | 37 | record_entity['RandomFieldName']=embedded_entity 38 | 39 | print(record_entity.exclude_from_indexes) 40 | print(record_entity['RandomFieldName'].exclude_from_indexes) 41 | print(embedded_entity.exclude_from_indexes) 42 | client.put(record_entity) 43 | client.put(embedded_entity) 44 | 45 | #Let us build a message board / news website 46 | 47 | #First, create a fake email for our fake user 48 | email = "me@fake.com" 49 | 50 | #Now, create a 'key' for that user using the email 51 | user_key = client.key('User', email) 52 | print( user_key ) 53 | 54 | #Now create a entity using that key 55 | new_user = datastore.Entity( key=user_key ) 56 | print( new_user ) 57 | 58 | #Add some fields to the entity 59 | 60 | new_user["name"] = unicode("Iam Fake") 61 | new_user["email"] = unicode(email) 62 | print( new_user ) 63 | 64 | #Push entity to the Cloud Datastore 65 | client.put( new_user ) 66 | 67 | #Get the user from datastore and print 68 | print( client.get(user_key) ) 69 | 70 | #Make a new incomplete key for the story 71 | #datastore will make a unique id automatically 72 | story_key = client.key( "Story" ) 73 | new_story = datastore.Entity( key = story_key ) 74 | 75 | #Add some fields 76 | new_story["url"] = unicode("cloud.google.com") 77 | new_story["title"] = unicode("Google is an awesome cloud provider") 78 | new_story["text"] = unicode("Check out this cool website I found for Cloud Stuff!") 79 | new_story['timestamp'] = datetime.datetime.now() 80 | print( new_story ) 81 | 82 | #Push entity to the Cloud Datastore 83 | client.put( new_story ) 84 | 85 | #Query for the stories 86 | #This query is eventually consistant 87 | query = datastore.Query( client=client, kind='Story', order=["-timestamp"]) 88 | results = list( query.fetch() ) 89 | print( results ) 90 | 91 | #Make another story 92 | new_story = datastore.Entity( key = client.key("Story") ) 93 | new_story["url"] = unicode("blog.sandeepdinesh.com") 94 | new_story["title"] = unicode("Interesting Blog") 95 | new_story["text"] = unicode("This is a pretty cool blog I write. Check it out!") 96 | new_story['timestamp'] = datetime.datetime.now() 97 | client.put( new_story ) 98 | 99 | #Query for the stories 100 | results = list(query.fetch()) 101 | print( results ) 102 | 103 | #Lets add a comment to the first story 104 | 105 | #Get the id from the first story 106 | story = results[0] 107 | story_id = story.key.id_or_name 108 | print( story_id ) 109 | 110 | #Create the comment 111 | #The ancestor (parent) is the user 112 | comment_key = client.key('Comment', parent=user_key) 113 | new_comment = datastore.Entity( key=comment_key ) 114 | new_comment['text'] = unicode("Cool story bro") 115 | new_comment['storyid'] = unicode(story_id) 116 | new_comment['timestamp'] = datetime.datetime.now() 117 | print( new_comment ) 118 | 119 | #Push comment to datastore 120 | client.put( new_comment ) 121 | 122 | #Get the id from the second story 123 | story = results[1] 124 | story_id = story.key.id_or_name 125 | print( story_id ) 126 | 127 | #Create another comment 128 | new_comment = datastore.Entity( key=client.key('Comment', parent=user_key) ) 129 | new_comment['text'] = unicode("Wow. Much Awesome. So Rad.") 130 | new_comment['storyid'] = unicode(story_id) 131 | new_comment['timestamp'] = datetime.datetime.now() 132 | print( new_comment ) 133 | 134 | #Push comment to datastore 135 | client.put( new_comment ) 136 | 137 | #Query for all comments 138 | query = datastore.Query(client=client, kind='Comment', order=["timestamp"] ) 139 | results = list( query.fetch() ) 140 | print( results ) 141 | 142 | #Query for comments on a single story 143 | query = datastore.Query(client=client, kind='Comment', filters=[( 'storyid', '=', unicode(story_id) )], order=["timestamp"] ) 144 | 145 | #Query will fail without a joint index on storyid and timestamp! 146 | 147 | #Run Query 148 | results = list( query.fetch() ) 149 | print( results ) 150 | 151 | #Let's make a new user and comment on the same story 152 | email = "msfake@fake.com" 153 | second_user = datastore.Entity( key=client.key('User', email) ) 154 | second_user["name"] = unicode("Shesa Fakealso") 155 | second_user["email"] = unicode(email) 156 | client.put( second_user ) 157 | 158 | new_comment = datastore.Entity( key=client.key('Comment', parent=client.key('User', email) ) ) 159 | new_comment['text'] = unicode("Boring story :( ") 160 | new_comment['storyid'] = unicode(story_id) 161 | new_comment['timestamp'] = datetime.datetime.now() 162 | client.put( new_comment ) 163 | 164 | #Query again 165 | query = datastore.Query(client=client, kind='Comment', filters=[( 'storyid', '=', unicode(story_id) )], order=["timestamp"] ) 166 | results = list( query.fetch() ) 167 | print( results ) 168 | 169 | #Perform strongly consistant query 170 | #Use the user_key as the ancestor to get the users comments 171 | query = datastore.Query(client=client, kind='Comment', ancestor=user_key ) 172 | results = list( query.fetch() ) 173 | print( results ) 174 | 175 | #Thats it! 176 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /app-engine-metadata/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /cloud-vision-nodejs/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | --------------------------------------------------------------------------------