API hub API: Node.js Client
API hub API client for Node.js
A comprehensive list of changes in each version may be found in the CHANGELOG.
- API hub API Node.js Client API Reference
- API hub API Documentation
- github.com/googleapis/google-cloud-node/packages/google-cloud-apihub
Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.
Table of contents:
Quickstart
Before you begin
- Select or create a Cloud Platform project.
- Enable billing for your project.
- Enable the API hub API API.
- Set up authentication with a service account so you can access the API from your local workstation.
Installing the client library
npm install @google-cloud/apihub
Using the client library
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The parent, which owns this collection of deployment resources.
* Format: `projects/{project}/locations/{location}`
*/
// const parent = 'abc123'
/**
* Optional. An expression that filters the list of Deployments.
* A filter expression consists of a field name, a comparison
* operator, and a value for filtering. The value must be a string. The
* comparison operator must be one of: `<`, `>` or
* `=`. Filters are not case sensitive.
* The following fields in the `Deployments` are eligible for filtering:
* * `display_name` - The display name of the Deployment. Allowed
* comparison operators: `=`.
* * `create_time` - The time at which the Deployment was created. The
* value should be in the (RFC3339)https://tools.ietf.org/html/rfc3339
* format. Allowed comparison operators: `>` and `<`.
* * `resource_uri` - A URI to the deployment resource. Allowed
* comparison operators: `=`.
* * `api_versions` - The API versions linked to this deployment. Allowed
* comparison operators: `:`.
* * `deployment_type.enum_values.values.id` - The allowed value id of the
* deployment_type attribute associated with the Deployment. Allowed
* comparison operators: `:`.
* * `deployment_type.enum_values.values.display_name` - The allowed value
* display name of the deployment_type attribute associated with the
* Deployment. Allowed comparison operators: `:`.
* * `slo.string_values.values` -The allowed string value of the slo
* attribute associated with the deployment. Allowed comparison
* operators: `:`.
* * `environment.enum_values.values.id` - The allowed value id of the
* environment attribute associated with the deployment. Allowed
* comparison operators: `:`.
* * `environment.enum_values.values.display_name` - The allowed value
* display name of the environment attribute associated with the deployment.
* Allowed comparison operators: `:`.
* Expressions are combined with either `AND` logic operator or `OR` logical
* operator but not both of them together i.e. only one of the `AND` or `OR`
* operator can be used throughout the filter string and both the operators
* cannot be used together. No other logical operators are supported. At most
* three filter fields are allowed in the filter string and if provided
* more than that then `INVALID_ARGUMENT` error is returned by the API.
* Here are a few examples:
* * `environment.enum_values.values.id: staging-id` - The allowed value id
* of the environment attribute associated with the Deployment is
* _staging-id_.
* * `environment.enum_values.values.display_name: \"Staging Deployment\"` -
* The allowed value display name of the environment attribute associated
* with the Deployment is `Staging Deployment`.
* * `environment.enum_values.values.id: production-id AND create_time <
* \"2021-08-15T14:50:00Z\" AND create_time > \"2021-08-10T12:00:00Z\"` -
* The allowed value id of the environment attribute associated with the
* Deployment is _production-id_ and Deployment was created before
* _2021-08-15 14:50:00 UTC_ and after _2021-08-10 12:00:00 UTC_.
* * `environment.enum_values.values.id: production-id OR
* slo.string_values.values: \"99.99%\"`
* - The allowed value id of the environment attribute Deployment is
* _production-id_ or string value of the slo attribute is _99.99%_.
*/
// const filter = 'abc123'
/**
* Optional. The maximum number of deployment resources to return. The service
* may return fewer than this value. If unspecified, at most 50 deployments
* will be returned. The maximum value is 1000; values above 1000 will be
* coerced to 1000.
*/
// const pageSize = 1234
/**
* Optional. A page token, received from a previous `ListDeployments` call.
* Provide this to retrieve the subsequent page.
* When paginating, all other parameters (except page_size) provided to
* `ListDeployments` must match the call that provided the page token.
*/
// const pageToken = 'abc123'
// Imports the Apihub library
const {ApiHubClient} = require('@google-cloud/apihub').v1;
// Instantiates a client
const apihubClient = new ApiHubClient({fallback: 'rest'});
async function callListDeployments() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = apihubClient.listDeploymentsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListDeployments();
Samples
Samples are in the samples/
directory. Each sample's README.md
has instructions for running its sample.
Sample | Source Code | Try it |
---|---|---|
Api_hub.create_api | source code | |
Api_hub.create_attribute | source code | |
Api_hub.create_deployment | source code | |
Api_hub.create_external_api | source code | |
Api_hub.create_spec | source code | |
Api_hub.create_version | source code | |
Api_hub.delete_api | source code | |
Api_hub.delete_attribute | source code | |
Api_hub.delete_deployment | source code | |
Api_hub.delete_external_api | source code | |
Api_hub.delete_spec | source code | |
Api_hub.delete_version | source code | |
Api_hub.get_api | source code | |
Api_hub.get_api_operation | source code | |
Api_hub.get_attribute | source code | |
Api_hub.get_definition | source code | |
Api_hub.get_deployment | source code | |
Api_hub.get_external_api | source code | |
Api_hub.get_spec | source code | |
Api_hub.get_spec_contents | source code | |
Api_hub.get_version | source code | |
Api_hub.list_api_operations | source code | |
Api_hub.list_apis | source code | |
Api_hub.list_attributes | source code | |
Api_hub.list_deployments | source code | |
Api_hub.list_external_apis | source code | |
Api_hub.list_specs | source code | |
Api_hub.list_versions | source code | |
Api_hub.search_resources | source code | |
Api_hub.update_api | source code | |
Api_hub.update_attribute | source code | |
Api_hub.update_deployment | source code | |
Api_hub.update_external_api | source code | |
Api_hub.update_spec | source code | |
Api_hub.update_version | source code | |
Api_hub_dependencies.create_dependency | source code | |
Api_hub_dependencies.delete_dependency | source code | |
Api_hub_dependencies.get_dependency | source code | |
Api_hub_dependencies.list_dependencies | source code | |
Api_hub_dependencies.update_dependency | source code | |
Api_hub_plugin.disable_plugin | source code | |
Api_hub_plugin.enable_plugin | source code | |
Api_hub_plugin.get_plugin | source code | |
Host_project_registration_service.create_host_project_registration | source code | |
Host_project_registration_service.get_host_project_registration | source code | |
Host_project_registration_service.list_host_project_registrations | source code | |
Linting_service.get_style_guide | source code | |
Linting_service.get_style_guide_contents | source code | |
Linting_service.lint_spec | source code | |
Linting_service.update_style_guide | source code | |
Provisioning.create_api_hub_instance | source code | |
Provisioning.get_api_hub_instance | source code | |
Provisioning.lookup_api_hub_instance | source code | |
Runtime_project_attachment_service.create_runtime_project_attachment | source code | |
Runtime_project_attachment_service.delete_runtime_project_attachment | source code | |
Runtime_project_attachment_service.get_runtime_project_attachment | source code | |
Runtime_project_attachment_service.list_runtime_project_attachments | source code | |
Runtime_project_attachment_service.lookup_runtime_project_attachment | source code | |
Quickstart | source code |
The API hub API Node.js Client API Reference documentation also contains samples.
Supported Node.js Versions
Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js. If you are using an end-of-life version of Node.js, we recommend that you update as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a best-efforts basis with the following warnings:
- Legacy versions are not tested in continuous integration.
- Some security patches and features cannot be backported.
- Dependencies cannot be kept up-to-date.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed through npm dist-tags.
The dist-tags follow the naming convention legacy-(version)
.
For example, npm install @google-cloud/apihub@legacy-8
installs client libraries
for versions compatible with Node.js 8.
Versioning
This library follows Semantic Versioning.
This library is considered to be in preview. This means it is still a work-in-progress and under active development. Any release is subject to backwards-incompatible changes at any time.
More Information: Google Cloud Platform Launch Stages
Contributing
Contributions welcome! See the Contributing Guide.
Please note that this README.md
, the samples/README.md
,
and a variety of configuration files in this repository (including .nycrc
and tsconfig.json
)
are generated from a central template. To edit one of these files, make an edit
to its templates in
directory.
License
Apache Version 2.0
See LICENSE