diff --git a/functions/uuid/README.md b/functions/uuid/README.md deleted file mode 100644 index 348769a243..0000000000 --- a/functions/uuid/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Google Cloud Platform logo - -# Google Cloud Functions UUID sample - -This sample shows a Google Cloud Function that uses a dependency from NPM, and -is a handy way to generate a v4 UUID from the command-line. - -View the [documentation][docs] or the [source code][code]. - -[docs]: https://cloud.google.com/functions/writing -[code]: index.js - -## Deploy and Test - -1. Follow the [Cloud Functions quickstart guide][quickstart] to setup Cloud -Functions for your project. - -1. Clone this repository: - - git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git - cd nodejs-docs-samples/functions/uuid - -1. Deploy the `getUuid` function with an HTTP trigger: - - gcloud functions deploy getUuid --trigger-http - -1. Call the `getUuid` function: - - gcloud functions call getUuid - - You should see something like this in your console: - - executionId: abcd1234-0 - result: 0ef22088-07f2-44ca-9cef-cea8ff666d69 - -[quickstart]: https://cloud.google.com/functions/quickstart diff --git a/functions/uuid/index.js b/functions/uuid/index.js deleted file mode 100644 index 889bf1d801..0000000000 --- a/functions/uuid/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2016, 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. - */ - -'use strict'; - -// [START functions_uuid] -const uuid = require('uuid'); - -// Return a newly generated UUID in the HTTP response. -exports.getUuid = (req, res) => { - res.send(uuid.v4()); -}; -// [END functions_uuid] diff --git a/functions/uuid/package.json b/functions/uuid/package.json deleted file mode 100644 index 28d031a34d..0000000000 --- a/functions/uuid/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "nodejs-docs-samples-functions-uuid", - "version": "0.0.1", - "private": true, - "license": "Apache-2.0", - "author": "Google Inc.", - "repository": { - "type": "git", - "url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" - }, - "engines": { - "node": ">=8.0.0" - }, - "scripts": { - "test": "mocha test/*.test.js --timeout=20000" - }, - "dependencies": { - "uuid": "^3.3.2" - }, - "devDependencies": { - "@google-cloud/nodejs-repo-tools": "^3.3.0", - "mocha": "^6.0.0", - "sinon": "^7.2.7" - }, - "cloud-repo-tools": { - "requiresKeyFile": true, - "requiresProjectId": true - } -} diff --git a/functions/uuid/test/index.test.js b/functions/uuid/test/index.test.js deleted file mode 100644 index 50e83c30c0..0000000000 --- a/functions/uuid/test/index.test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017, 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. - */ - -'use strict'; - -const sinon = require('sinon'); -const assert = require('assert'); - -const uuidSample = require('../'); - -it('should generate a uuid', () => { - const req = {}; - const res = { - send: sinon.stub(), - }; - uuidSample.getUuid(req, res); - - assert.strictEqual(res.send.callCount, 1); - assert.strictEqual(typeof res.send.firstCall.args[0], 'string'); - assert.strictEqual(res.send.firstCall.args[0].length, 36); -});