resources.proto 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.api.apikeys.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.ApiKeys.V2";
  20. option go_package = "google.golang.org/genproto/googleapis/api/apikeys/v2;apikeys";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "ResourcesProto";
  23. option java_package = "com.google.api.apikeys.v2";
  24. option php_namespace = "Google\\Cloud\\ApiKeys\\V2";
  25. option ruby_package = "Google::Cloud::ApiKeys::V2";
  26. // The representation of a key managed by the API Keys API.
  27. message Key {
  28. option (google.api.resource) = {
  29. type: "apikeys.googleapis.com/Key"
  30. pattern: "projects/{project}/locations/{location}/keys/{key}"
  31. plural: "keys"
  32. singular: "key"
  33. style: DECLARATIVE_FRIENDLY
  34. };
  35. // Output only. The resource name of the key.
  36. // The `name` has the form:
  37. // `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
  38. // For example:
  39. // `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
  40. //
  41. // NOTE: Key is a global resource; hence the only supported value for
  42. // location is `global`.
  43. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  44. // Output only. Unique id in UUID4 format.
  45. string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  46. // Human-readable display name of this key that you can modify.
  47. // The maximum length is 63 characters.
  48. string display_name = 2;
  49. // Output only. An encrypted and signed value held by this key.
  50. // This field can be accessed only through the `GetKeyString` method.
  51. string key_string = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  52. // Output only. A timestamp identifying the time this key was originally
  53. // created.
  54. google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  55. // Output only. A timestamp identifying the time this key was last
  56. // updated.
  57. google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  58. // Output only. A timestamp when this key was deleted. If the resource is not deleted,
  59. // this must be empty.
  60. google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  61. // Annotations is an unstructured key-value map stored with a policy that
  62. // may be set by external tools to store and retrieve arbitrary metadata.
  63. // They are not queryable and should be preserved when modifying objects.
  64. map<string, string> annotations = 8;
  65. // Key restrictions.
  66. Restrictions restrictions = 9;
  67. // Output only. A checksum computed by the server based on the current value of the Key
  68. // resource. This may be sent on update and delete requests to ensure the
  69. // client has an up-to-date value before proceeding.
  70. // See https://google.aip.dev/154.
  71. string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  72. }
  73. // Describes the restrictions on the key.
  74. message Restrictions {
  75. // The websites, IP addresses, Android apps, or iOS apps (the clients) that
  76. // are allowed to use the key. You can specify only one type of client
  77. // restrictions per key.
  78. oneof client_restrictions {
  79. // The HTTP referrers (websites) that are allowed to use the key.
  80. BrowserKeyRestrictions browser_key_restrictions = 1;
  81. // The IP addresses of callers that are allowed to use the key.
  82. ServerKeyRestrictions server_key_restrictions = 2;
  83. // The Android apps that are allowed to use the key.
  84. AndroidKeyRestrictions android_key_restrictions = 3;
  85. // The iOS apps that are allowed to use the key.
  86. IosKeyRestrictions ios_key_restrictions = 4;
  87. }
  88. // A restriction for a specific service and optionally one or
  89. // more specific methods. Requests are allowed if they
  90. // match any of these restrictions. If no restrictions are
  91. // specified, all targets are allowed.
  92. repeated ApiTarget api_targets = 5;
  93. }
  94. // The HTTP referrers (websites) that are allowed to use the key.
  95. message BrowserKeyRestrictions {
  96. // A list of regular expressions for the referrer URLs that are allowed
  97. // to make API calls with this key.
  98. repeated string allowed_referrers = 1;
  99. }
  100. // The IP addresses of callers that are allowed to use the key.
  101. message ServerKeyRestrictions {
  102. // A list of the caller IP addresses that are allowed to make API calls
  103. // with this key.
  104. repeated string allowed_ips = 1;
  105. }
  106. // The Android apps that are allowed to use the key.
  107. message AndroidKeyRestrictions {
  108. // A list of Android applications that are allowed to make API calls with
  109. // this key.
  110. repeated AndroidApplication allowed_applications = 1;
  111. }
  112. // Identifier of an Android application for key use.
  113. message AndroidApplication {
  114. // The SHA1 fingerprint of the application. For example, both sha1 formats are
  115. // acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
  116. // DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
  117. // Output format is the latter.
  118. string sha1_fingerprint = 1;
  119. // The package name of the application.
  120. string package_name = 2;
  121. }
  122. // The iOS apps that are allowed to use the key.
  123. message IosKeyRestrictions {
  124. // A list of bundle IDs that are allowed when making API calls with this key.
  125. repeated string allowed_bundle_ids = 1;
  126. }
  127. // A restriction for a specific service and optionally one or multiple
  128. // specific methods. Both fields are case insensitive.
  129. message ApiTarget {
  130. // The service for this restriction. It should be the canonical
  131. // service name, for example: `translate.googleapis.com`.
  132. // You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
  133. // to get a list of services that are enabled in the project.
  134. string service = 1;
  135. // Optional. List of one or more methods that can be called.
  136. // If empty, all methods for the service are allowed. A wildcard
  137. // (*) can be used as the last symbol.
  138. // Valid examples:
  139. // `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
  140. // `TranslateText`
  141. // `Get*`
  142. // `translate.googleapis.com.Get*`
  143. repeated string methods = 2 [(google.api.field_behavior) = OPTIONAL];
  144. }