-
Notifications
You must be signed in to change notification settings - Fork 33
registry rpc
Tim Burks edited this page Mar 2, 2023
·
5 revisions
All commands under the rpc
subcommand are automatically-generated by protoc-gen-go_cli. They provide direct access to all methods of the Registry service.
Run registry help rpc
for a list of commands and registry help rpc SUBCOMMAND
for help on any subcommand.
registry rpc
provides the lowest level of command-line access to a registry. While not normally preferred, these commands
allow full control of registry contents, as illustrated below.
# Create an API entry in the registry.
registry rpc create-api \
--api_id petstore \
--parent projects/$PROJECT/locations/global \
--json
# Create an entry for a version of the API that we just added.
registry rpc create-api-version \
--api_version_id 1.0.0 \
--parent projects/$PROJECT/locations/global/apis/petstore \
--json
# Create an entry for a spec of this version and include the spec contents.
# Note that the mime type is required by downstream tools.
registry rpc create-api-spec \
--api_spec_id openapi \
--parent projects/$PROJECT/locations/global/apis/petstore/versions/1.0.0 \
--api_spec.contents `xxd -c 10000 -p petstore.yaml` \
--api_spec.filename "petstore.yaml" \
--api_spec.mime_type "application/x.openapi?version=3" \
--json
# List all of the specs in the registry.
# Note that the dashes (-) in the parent are wildcards.
registry rpc list-api-specs \
--parent projects/$PROJECT/locations/global/apis/-/versions/- \
--json
# Get metadata describing the API spec that we just uploaded.
registry rpc get-api-spec \
--name projects/$PROJECT/locations/global/apis/petstore/versions/1.0.0/specs/openapi \
--json
# Get the contents of the API spec.
registry rpc get-api-spec-contents \
--name projects/$PROJECT/locations/global/apis/petstore/versions/1.0.0/specs/openapi \
--json | jq .data -r | base64 -d
- The
registry rpc
subcommands currently do not recognize theregistry.project
setting. Resource names must be fully-specified and include theprojects/PROJECT/locations/global
prefix.