Skip to content

registry export

Tim Burks edited this page Mar 2, 2023 · 4 revisions

registry export takes the same PATTERN values as registry get, but instead of writing the results to stdout, it writes them into a directory structure that matches the registry hierarchy. This allows registries to be exported and inspected in more detailed ways that allow fine-grained modifications and updates to individual resources.

For a description of the directory structure, see A Recommended Directory Structure for Exported Registries.

The following registry export invocation exports the entire contents of projects/favs:

# Export the entire contents of the "favs" project.
$ registry export projects/favs
  INFO[0000] Exported projects/favs/locations/global/apis/translate uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/artifacts/summary uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v2 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com/versions/4.0 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/artifacts/taxonomies uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/discovery uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/google-cloud-translate-v3 uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/discovery uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com/versions/4.0/specs/openapi uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v2/specs/discovery uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/discovery@90388ad2/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/google-cloud-translate-v3@ea6773ad/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1@36cc846e/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/discovery@adbacbd6/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v2/specs/discovery@8d1f599c/artifacts/vocabulary uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v2/specs/discovery@8d1f599c/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com/versions/4.0/specs/openapi@e18896ce/artifacts/complexity uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/discovery@90388ad2/artifacts/vocabulary uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/discovery@adbacbd6/artifacts/vocabulary uid=b3ea01ea
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com/versions/4.0/specs/openapi@e18896ce/artifacts/vocabulary uid=b3ea01ea

# Review the exported file structure with `find`.
$ find favs
favs
favs/artifacts
favs/artifacts/summary.yaml
favs/artifacts/taxonomies.yaml
favs/apis
favs/apis/wordnik.com
favs/apis/wordnik.com/versions
favs/apis/wordnik.com/versions/4.0
favs/apis/wordnik.com/versions/4.0/specs
favs/apis/wordnik.com/versions/4.0/specs/openapi
favs/apis/wordnik.com/versions/4.0/specs/openapi/artifacts
favs/apis/wordnik.com/versions/4.0/specs/openapi/artifacts/vocabulary.yaml
favs/apis/wordnik.com/versions/4.0/specs/openapi/artifacts/complexity.yaml
favs/apis/wordnik.com/versions/4.0/specs/openapi/openapi.yaml
favs/apis/wordnik.com/versions/4.0/specs/openapi/info.yaml
favs/apis/wordnik.com/versions/4.0/info.yaml
favs/apis/wordnik.com/info.yaml
favs/apis/translate
favs/apis/translate/versions
favs/apis/translate/versions/v3beta1
favs/apis/translate/versions/v3beta1/specs
favs/apis/translate/versions/v3beta1/specs/discovery
favs/apis/translate/versions/v3beta1/specs/discovery/artifacts
favs/apis/translate/versions/v3beta1/specs/discovery/artifacts/vocabulary.yaml
favs/apis/translate/versions/v3beta1/specs/discovery/artifacts/complexity.yaml
favs/apis/translate/versions/v3beta1/specs/discovery/discovery.json
favs/apis/translate/versions/v3beta1/specs/discovery/info.yaml
favs/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1
favs/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1/google-cloud-translate-v3beta1.zip
favs/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1/artifacts
favs/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1/artifacts/complexity.yaml
favs/apis/translate/versions/v3beta1/specs/google-cloud-translate-v3beta1/info.yaml
favs/apis/translate/versions/v3beta1/info.yaml
favs/apis/translate/versions/v3
favs/apis/translate/versions/v3/specs
favs/apis/translate/versions/v3/specs/discovery
favs/apis/translate/versions/v3/specs/discovery/artifacts
favs/apis/translate/versions/v3/specs/discovery/artifacts/vocabulary.yaml
favs/apis/translate/versions/v3/specs/discovery/artifacts/complexity.yaml
favs/apis/translate/versions/v3/specs/discovery/discovery.json
favs/apis/translate/versions/v3/specs/discovery/info.yaml
favs/apis/translate/versions/v3/specs/google-cloud-translate-v3
favs/apis/translate/versions/v3/specs/google-cloud-translate-v3/artifacts
favs/apis/translate/versions/v3/specs/google-cloud-translate-v3/artifacts/complexity.yaml
favs/apis/translate/versions/v3/specs/google-cloud-translate-v3/google-cloud-translate-v3.zip
favs/apis/translate/versions/v3/specs/google-cloud-translate-v3/info.yaml
favs/apis/translate/versions/v3/info.yaml
favs/apis/translate/versions/v2
favs/apis/translate/versions/v2/specs
favs/apis/translate/versions/v2/specs/discovery
favs/apis/translate/versions/v2/specs/discovery/artifacts
favs/apis/translate/versions/v2/specs/discovery/artifacts/vocabulary.yaml
favs/apis/translate/versions/v2/specs/discovery/artifacts/complexity.yaml
favs/apis/translate/versions/v2/specs/discovery/discovery.json
favs/apis/translate/versions/v2/specs/discovery/info.yaml
favs/apis/translate/versions/v2/info.yaml
favs/apis/translate/info.yaml

It's also possible to export subsets of the registry. Exported resources are written into the same directory structure illustrated above.

# Export only the spec artifacts named "vocabulary".
$ registry export projects/favs/locations/global/apis/-/versions/-/specs/-/artifacts/vocabulary
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v2/specs/discovery@8d1f599c/artifacts/vocabulary uid=aaeeb302
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3/specs/discovery@90388ad2/artifacts/vocabulary uid=aaeeb302
  INFO[0000] Exported projects/favs/locations/global/apis/wordnik.com/versions/4.0/specs/openapi@e18896ce/artifacts/vocabulary uid=aaeeb302
  INFO[0000] Exported projects/favs/locations/global/apis/translate/versions/v3beta1/specs/discovery@adbacbd6/artifacts/vocabulary uid=aaeeb302

# Note that the directory structure is the same as before, but only the vocabulary artifacts are present.
$ find favs
favs
favs/apis
favs/apis/wordnik.com
favs/apis/wordnik.com/versions
favs/apis/wordnik.com/versions/4.0
favs/apis/wordnik.com/versions/4.0/specs
favs/apis/wordnik.com/versions/4.0/specs/openapi
favs/apis/wordnik.com/versions/4.0/specs/openapi/artifacts
favs/apis/wordnik.com/versions/4.0/specs/openapi/artifacts/vocabulary.yaml
favs/apis/translate
favs/apis/translate/versions
favs/apis/translate/versions/v3beta1
favs/apis/translate/versions/v3beta1/specs
favs/apis/translate/versions/v3beta1/specs/discovery
favs/apis/translate/versions/v3beta1/specs/discovery/artifacts
favs/apis/translate/versions/v3beta1/specs/discovery/artifacts/vocabulary.yaml
favs/apis/translate/versions/v3
favs/apis/translate/versions/v3/specs
favs/apis/translate/versions/v3/specs/discovery
favs/apis/translate/versions/v3/specs/discovery/artifacts
favs/apis/translate/versions/v3/specs/discovery/artifacts/vocabulary.yaml
favs/apis/translate/versions/v2
favs/apis/translate/versions/v2/specs
favs/apis/translate/versions/v2/specs/discovery
favs/apis/translate/versions/v2/specs/discovery/artifacts
favs/apis/translate/versions/v2/specs/discovery/artifacts/vocabulary.yaml