Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

migrate code from googleapis/nodejs-service-directory #2863

Merged
merged 37 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d6b417a
feat!: initial generation of library (#1)
bcoe Mar 13, 2020
a2ae9f8
chore: release 1.0.0 (#5)
release-please[bot] Mar 13, 2020
9eb4636
chore: release 1.0.1 (#9)
release-please[bot] Mar 17, 2020
2928c45
chore(deps): update dependency @types/mocha (#6)
renovate-bot Mar 17, 2020
2bfc36b
chore(deps): update dependency c8 to v7 (#7)
renovate-bot Mar 17, 2020
06a0df2
feat(samples): add Service directory samples (#42)
katiehochberg May 11, 2020
62463b7
chore: release 2.0.0 (#23)
release-please[bot] Jun 2, 2020
f1ed979
chore(deps): update dependency mocha to v8 (#50)
renovate-bot Jun 11, 2020
8265627
chore: release 2.1.0 (#51)
release-please[bot] Jun 16, 2020
70a7ce7
chore: release 2.1.1 (#54)
release-please[bot] Jul 7, 2020
2b85289
chore: release 2.1.2 (#89)
release-please[bot] Nov 11, 2020
a4e77d1
chore: release 3.0.0 (#97)
release-please[bot] Nov 19, 2020
e040f4d
fix(deps): update dependency json-schema to ^0.3.0 (#102)
renovate-bot Jan 7, 2021
2a14b80
chore: release 3.1.0 (#106)
release-please[bot] Jan 12, 2021
cc6e1ad
chore: release 3.1.1 (#136)
release-please[bot] May 13, 2021
2597163
chore: release 3.1.2 (#145)
release-please[bot] May 25, 2021
ab36206
chore: release 3.1.3 (#154)
release-please[bot] Jun 23, 2021
1482617
chore: release 3.2.0 (#157)
release-please[bot] Jun 29, 2021
afaf75f
chore: release 3.2.1 (#161)
release-please[bot] Jun 30, 2021
fb65a32
chore: release 3.2.2 (#163)
release-please[bot] Jul 13, 2021
fefa4c6
chore: release 3.2.3 (#165)
release-please[bot] Jul 16, 2021
92b06a7
chore: release 3.2.4 (#173)
release-please[bot] Aug 17, 2021
d6c2ee1
chore: release 3.3.0 (#175)
release-please[bot] Aug 24, 2021
f06f96a
chore: release 3.3.1 (#178)
release-please[bot] Sep 10, 2021
6bdacad
fix(deps): update dependency json-schema to ^0.4.0 (#192)
renovate-bot Nov 12, 2021
501e2ad
chore: release 3.3.2 (#194)
release-please[bot] Nov 15, 2021
a6ca5f4
chore(main): release 3.4.0 (#217)
release-please[bot] Apr 11, 2022
095856d
build!: update library to use Node 12 (#229)
sofisl May 20, 2022
23a0802
chore(main): release 4.0.0 (#231)
release-please[bot] Jun 6, 2022
5e5878d
chore(main): release 4.0.1 (#237)
release-please[bot] Jun 30, 2022
ee4adcb
chore(main): release 4.0.2 (#243)
release-please[bot] Aug 26, 2022
dffd44a
chore(main): release 4.0.3 (#247)
release-please[bot] Sep 7, 2022
bc9adaa
fix(deps): update dependency uuid to v9 (#248)
renovate-bot Sep 9, 2022
9aa6563
chore(main): release 4.0.4 (#249)
release-please[bot] Nov 11, 2022
5e37dca
Merge remote-tracking branch 'migration/main' into nodejs-service-dir…
Nov 17, 2022
c7c2cf9
add github workflow for service directory
Nov 17, 2022
1a79e70
Merge branch 'main' into nodejs-service-directory-migration
Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/service-directory-snippets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: service-directory-snippets
on:
push:
branches:
- main
paths:
- 'service-directory/snippets/**'
pull_request:
paths:
- 'service-directory/snippets/**'
pull_request_target:
types: [labeled]
paths:
- 'service-directory/snippets/**'
schedule:
- cron: '0 0 * * 0'
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: 'write'
pull-requests: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v3.1.0
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: 'google-github-actions/auth@v1.0.0'
with:
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com'
create_credentials_file: 'true'
access_token_lifetime: 600s
- uses: actions/setup-node@v3.5.1
with:
node-version: 16
- run: npm install
working-directory: service-directory/snippets
- run: npm test
working-directory: service-directory/snippets
env:
MOCHA_REPORTER_SUITENAME: service_directory_snippets
MOCHA_REPORTER_OUTPUT: service_directory_snippets_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"datacatalog/quickstart",
"datastore/functions",
"scheduler",
"service-directory/snippets",
"talent",
"video-intelligence",
"contact-center-insights",
Expand Down
67 changes: 67 additions & 0 deletions service-directory/snippets/createEndpoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function main(
projectId = 'my-project',
locationId = 'us-east1',
namespaceId = 'my-namespace',
serviceId = 'my-service',
endpointId = 'my-endpoint'
) {
// [START servicedirectory_create_endpoint]
//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-central1';
// const namespaceId = 'my-namespace';
// const serviceId = 'my-service';
// const endpointId = 'my-endpoint';

// Imports the Google Cloud client library
const {
RegistrationServiceClient,
} = require('@google-cloud/service-directory');

// Creates a client
const registrationServiceClient = new RegistrationServiceClient();

// Build the service name
const serviceName = registrationServiceClient.servicePath(
projectId,
locationId,
namespaceId,
serviceId
);

async function createEndpoint() {
const [endpoint] = await registrationServiceClient.createEndpoint({
parent: serviceName,
endpointId: endpointId,
endpoint: {address: '10.0.0.1', port: 8080},
});

console.log(`Created endpoint: ${endpoint.name}`);
return endpoint;
}

return createEndpoint();
// [END servicedirectory_create_endpoint]
}

const args = process.argv.slice(2);
main(...args).catch(console.error);
60 changes: 60 additions & 0 deletions service-directory/snippets/createNamespace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function main(
projectId = 'my-project',
locationId = 'us-central1',
namespaceId = 'my-namespace'
) {
// [START servicedirectory_create_namespace]
//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-central1';
// const namespaceId = 'my-namespace';

// Imports the Google Cloud client library
const {
RegistrationServiceClient,
} = require('@google-cloud/service-directory');

// Creates a client
const registrationServiceClient = new RegistrationServiceClient();

// Build the location name
const locationName = registrationServiceClient.locationPath(
projectId,
locationId
);

async function createNamespace() {
const [namespace] = await registrationServiceClient.createNamespace({
parent: locationName,
namespaceId: namespaceId,
});

console.log(`Created namespace: ${namespace.name}`);
return namespace;
}

return createNamespace();
// [END servicedirectory_create_namespace]
}

const args = process.argv.slice(2);
main(...args).catch(console.error);
63 changes: 63 additions & 0 deletions service-directory/snippets/createService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function main(
projectId = 'my-project',
locationId = 'us-east1',
namespaceId = 'my-namespace',
serviceId = 'my-service'
) {
// [START servicedirectory_create_service]
//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-central1';
// const namespaceId = 'my-namespace';
// const serviceId = 'my-service';

// Imports the Google Cloud client library
const {
RegistrationServiceClient,
} = require('@google-cloud/service-directory');

// Creates a client
const registrationServiceClient = new RegistrationServiceClient();

// Build the namespace name
const namespaceName = registrationServiceClient.namespacePath(
projectId,
locationId,
namespaceId
);

async function createService() {
const [service] = await registrationServiceClient.createService({
parent: namespaceName,
serviceId: serviceId,
});

console.log(`Created service: ${service.name}`);
return service;
}

return createService();
// [END servicedirectory_create_service]
}

const args = process.argv.slice(2);
main(...args).catch(console.error);
65 changes: 65 additions & 0 deletions service-directory/snippets/deleteEndpoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function main(
projectId = 'my-project',
locationId = 'us-east1',
namespaceId = 'my-namespace',
serviceId = 'my-service',
endpointId = 'my-endpoint'
) {
// [START servicedirectory_delete_endpoint]
//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-central1';
// const namespaceId = 'my-namespace';
// const serviceId = 'my-service';
// const endpointId = 'my-endpoint';

// Imports the Google Cloud client library
const {
RegistrationServiceClient,
} = require('@google-cloud/service-directory');

// Creates a client
const registrationServiceClient = new RegistrationServiceClient();

// Build the endpoint name
const endpointName = registrationServiceClient.endpointPath(
projectId,
locationId,
namespaceId,
serviceId,
endpointId
);

async function deleteEndpoint() {
await registrationServiceClient.deleteEndpoint({
name: endpointName,
});

console.log(`Deleted endpoint: ${endpointName}`);
}

deleteEndpoint();
// [END servicedirectory_delete_endpoint]
}

const args = process.argv.slice(2);
main(...args).catch(console.error);
59 changes: 59 additions & 0 deletions service-directory/snippets/deleteNamespace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2020 Google LLC
//
// 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
//
// https://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';

async function main(
projectId = 'my-project',
locationId = 'us-east1',
namespaceId = 'my-namespace'
) {
// [START servicedirectory_delete_namespace]
//
// TODO(developer): Uncomment these variables before running the sample.
//
// const projectId = 'my-project';
// const locationId = 'us-central1';
// const namespaceId = 'my-namespace';

// Imports the Google Cloud client library
const {
RegistrationServiceClient,
} = require('@google-cloud/service-directory');

// Creates a client
const registrationServiceClient = new RegistrationServiceClient();

// Build the namespace name
const namespaceName = registrationServiceClient.namespacePath(
projectId,
locationId,
namespaceId
);

async function deleteNamespace() {
await registrationServiceClient.deleteNamespace({
name: namespaceName,
});

console.log(`Deleted namespace: ${namespaceName}`);
}

deleteNamespace();
// [END servicedirectory_delete_namespace]
}

const args = process.argv.slice(2);
main(...args).catch(console.error);
Loading