resource_settings.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. // Copyright 2021 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.cloud.resourcesettings.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. option cc_enable_arenas = true;
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1;resourcesettings";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "ResourceSettingsProto";
  24. option java_package = "com.google.cloud.resourcesettings.v1";
  25. // Client library namespace
  26. option csharp_namespace = "Google.Cloud.ResourceSettings.V1";
  27. option php_namespace = "Google\\Cloud\\ResourceSettings\\V1";
  28. option ruby_package = "Google::Cloud::ResourceSettings::V1";
  29. // An interface to interact with resource settings and setting values throughout
  30. // the resource hierarchy.
  31. //
  32. // Services may surface a number of settings for users to control how their
  33. // resources behave. Values of settings applied on a given Cloud resource are
  34. // evaluated hierarchically and inherited by all descendants of that resource.
  35. //
  36. // For all requests, returns a `google.rpc.Status` with
  37. // `google.rpc.Code.PERMISSION_DENIED` if the IAM check fails or the `parent`
  38. // resource is not in a Cloud Organization.
  39. // For all requests, returns a `google.rpc.Status` with
  40. // `google.rpc.Code.INVALID_ARGUMENT` if the request is malformed.
  41. service ResourceSettingsService {
  42. option (google.api.default_host) = "resourcesettings.googleapis.com";
  43. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  44. // Lists all the settings that are available on the Cloud resource `parent`.
  45. rpc ListSettings(ListSettingsRequest) returns (ListSettingsResponse) {
  46. option (google.api.http) = {
  47. get: "/v1/{parent=organizations/*}/settings"
  48. additional_bindings {
  49. get: "/v1/{parent=folders/*}/settings"
  50. }
  51. additional_bindings {
  52. get: "/v1/{parent=projects/*}/settings"
  53. }
  54. };
  55. option (google.api.method_signature) = "parent";
  56. }
  57. // Gets a setting.
  58. //
  59. // Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
  60. // setting does not exist.
  61. rpc GetSetting(GetSettingRequest) returns (Setting) {
  62. option (google.api.http) = {
  63. get: "/v1/{name=organizations/*/settings/*}"
  64. additional_bindings {
  65. get: "/v1/{name=folders/*/settings/*}"
  66. }
  67. additional_bindings {
  68. get: "/v1/{name=projects/*/settings/*}"
  69. }
  70. };
  71. option (google.api.method_signature) = "name";
  72. }
  73. // Updates a setting.
  74. //
  75. // Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
  76. // setting does not exist.
  77. // Returns a `google.rpc.Status` with `google.rpc.Code.FAILED_PRECONDITION` if
  78. // the setting is flagged as read only.
  79. // Returns a `google.rpc.Status` with `google.rpc.Code.ABORTED` if the etag
  80. // supplied in the request does not match the persisted etag of the setting
  81. // value.
  82. //
  83. // On success, the response will contain only `name`, `local_value` and
  84. // `etag`. The `metadata` and `effective_value` cannot be updated through
  85. // this API.
  86. //
  87. // Note: the supplied setting will perform a full overwrite of the
  88. // `local_value` field.
  89. rpc UpdateSetting(UpdateSettingRequest) returns (Setting) {
  90. option (google.api.http) = {
  91. patch: "/v1/{setting.name=organizations/*/settings/*}"
  92. body: "setting"
  93. additional_bindings {
  94. patch: "/v1/{setting.name=folders/*/settings/*}"
  95. body: "setting"
  96. }
  97. additional_bindings {
  98. patch: "/v1/{setting.name=projects/*/settings/*}"
  99. body: "setting"
  100. }
  101. };
  102. }
  103. }
  104. // The schema for settings.
  105. message Setting {
  106. option (google.api.resource) = {
  107. type: "resourcesettings.googleapis.com/Setting"
  108. pattern: "projects/{project_number}/settings/{setting_name}"
  109. pattern: "folders/{folder}/settings/{setting_name}"
  110. pattern: "organizations/{organization}/settings/{setting_name}"
  111. };
  112. // The resource name of the setting. Must be in one of the following forms:
  113. //
  114. // * `projects/{project_number}/settings/{setting_name}`
  115. // * `folders/{folder_id}/settings/{setting_name}`
  116. // * `organizations/{organization_id}/settings/{setting_name}`
  117. //
  118. // For example, "/projects/123/settings/gcp-enableMyFeature"
  119. string name = 1;
  120. // Output only. Metadata about a setting which is not editable by the end user.
  121. SettingMetadata metadata = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  122. // The configured value of the setting at the given parent resource (ignoring
  123. // the resource hierarchy). The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be
  124. // consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata].
  125. Value local_value = 8;
  126. // Output only. The computed effective value of the setting at the given parent resource
  127. // (based on the resource hierarchy).
  128. //
  129. // The effective value evaluates to one of the following options in the given
  130. // order (the next option is used if the previous one does not exist):
  131. //
  132. // 1. the local setting value on the given resource: [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value]
  133. // 2. if one of the given resource's ancestors have a local setting value,
  134. // the local value at the nearest such ancestor
  135. // 3. the setting's default value: [SettingMetadata.default_value][google.cloud.resourcesettings.v1.SettingMetadata.default_value]
  136. // 4. an empty value (defined as a `Value` with all fields unset)
  137. //
  138. // The data type of [Value][google.cloud.resourcesettings.v1.Value] must always be
  139. // consistent with the data type defined in [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata].
  140. Value effective_value = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
  141. // A fingerprint used for optimistic concurrency. See
  142. // [UpdateSetting][google.cloud.resourcesettings.v1.ResourceSettingsService.UpdateSetting] for more
  143. // details.
  144. string etag = 10;
  145. }
  146. // Metadata about a setting which is not editable by the end user.
  147. message SettingMetadata {
  148. // The data type for setting values of this setting. See [Value][google.cloud.resourcesettings.v1.Value] for more
  149. // details on the available data types.
  150. enum DataType {
  151. // Unspecified data type.
  152. DATA_TYPE_UNSPECIFIED = 0;
  153. // A boolean setting.
  154. BOOLEAN = 1;
  155. // A string setting.
  156. STRING = 2;
  157. // A string set setting.
  158. STRING_SET = 3;
  159. // A Enum setting
  160. ENUM_VALUE = 4;
  161. }
  162. // The human readable name for this setting.
  163. string display_name = 1;
  164. // A detailed description of what this setting does.
  165. string description = 2;
  166. // A flag indicating that values of this setting cannot be modified (see
  167. // documentation of the specific setting for updates and reasons).
  168. bool read_only = 3;
  169. // The data type for this setting.
  170. DataType data_type = 4;
  171. // The value provided by [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value] if no setting value is
  172. // explicitly set.
  173. //
  174. // Note: not all settings have a default value.
  175. Value default_value = 5;
  176. }
  177. // The data in a setting value.
  178. message Value {
  179. // A string set value that can hold a set of strings. The maximum length of
  180. // each string is 200 characters and there can be a maximum of 50 strings in
  181. // the string set.
  182. message StringSet {
  183. // The strings in the set
  184. repeated string values = 1;
  185. }
  186. // A enum value that can hold any enum type setting values.
  187. // Each enum type is represented by a number, this representation
  188. // is stored in the definitions.
  189. message EnumValue {
  190. // The value of this enum
  191. string value = 1;
  192. }
  193. // Selects the data type and associated value.
  194. oneof value {
  195. // Defines this value as being a boolean value.
  196. bool boolean_value = 1;
  197. // Defines this value as being a string value.
  198. string string_value = 2;
  199. // Defines this value as being a StringSet.
  200. StringSet string_set_value = 3;
  201. // Defines this value as being a Enum.
  202. EnumValue enum_value = 4;
  203. }
  204. }
  205. // The request for ListSettings.
  206. message ListSettingsRequest {
  207. // Required. The Cloud resource that parents the setting. Must be in one of the
  208. // following forms:
  209. //
  210. // * `projects/{project_number}`
  211. // * `projects/{project_id}`
  212. // * `folders/{folder_id}`
  213. // * `organizations/{organization_id}`
  214. string parent = 1 [
  215. (google.api.field_behavior) = REQUIRED,
  216. (google.api.resource_reference) = {
  217. type: "*"
  218. }
  219. ];
  220. // Unused. The size of the page to be returned.
  221. int32 page_size = 2;
  222. // Unused. A page token used to retrieve the next page.
  223. string page_token = 3;
  224. // The SettingView for this request.
  225. SettingView view = 4;
  226. }
  227. // The response from ListSettings.
  228. message ListSettingsResponse {
  229. // A list of settings that are available at the specified Cloud resource.
  230. repeated Setting settings = 1;
  231. // Unused. A page token used to retrieve the next page.
  232. string next_page_token = 2;
  233. }
  234. // The request for GetSetting.
  235. message GetSettingRequest {
  236. // Required. The name of the setting to get. See [Setting][google.cloud.resourcesettings.v1.Setting] for naming
  237. // requirements.
  238. string name = 1 [
  239. (google.api.field_behavior) = REQUIRED,
  240. (google.api.resource_reference) = {
  241. type: "resourcesettings.googleapis.com/Setting"
  242. }
  243. ];
  244. // The SettingView for this request.
  245. SettingView view = 2;
  246. }
  247. // The request for UpdateSetting.
  248. message UpdateSettingRequest {
  249. // Required. The setting to update. See [Setting][google.cloud.resourcesettings.v1.Setting] for field requirements.
  250. Setting setting = 1 [(google.api.field_behavior) = REQUIRED];
  251. }
  252. // View options for Settings.
  253. enum SettingView {
  254. // The default / unset value.
  255. // The API will default to the SETTING_VIEW_BASIC view.
  256. SETTING_VIEW_UNSPECIFIED = 0;
  257. // Include [Setting.metadata][google.cloud.resourcesettings.v1.Setting.metadata], but nothing else.
  258. // This is the default value (for both ListSettings and GetSetting).
  259. SETTING_VIEW_BASIC = 1;
  260. // Include [Setting.effective_value][google.cloud.resourcesettings.v1.Setting.effective_value], but nothing else.
  261. SETTING_VIEW_EFFECTIVE_VALUE = 2;
  262. // Include [Setting.local_value][google.cloud.resourcesettings.v1.Setting.local_value], but nothing else.
  263. SETTING_VIEW_LOCAL_VALUE = 3;
  264. }