rules.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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.cloud.paymentgateway.issuerswitch.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. import "google/cloud/paymentgateway/issuerswitch/v1/common_fields.proto";
  21. import "google/protobuf/empty.proto";
  22. option csharp_namespace = "Google.Cloud.PaymentGateway.IssuerSwitch.V1";
  23. option go_package = "google.golang.org/genproto/googleapis/cloud/paymentgateway/issuerswitch/v1;issuerswitch";
  24. option java_multiple_files = true;
  25. option java_outer_classname = "RulesProto";
  26. option java_package = "com.google.cloud.paymentgateway.issuerswitch.v1";
  27. option php_namespace = "Google\\Cloud\\PaymentGateway\\IssuerSwitch\\V1";
  28. option ruby_package = "Google::Cloud::PaymentGateway::IssuerSwitch::V1";
  29. // Manages rules used by the issuer switch's rules engine.
  30. service IssuerSwitchRules {
  31. option (google.api.default_host) = "issuerswitch.googleapis.com";
  32. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  33. // List all rules that are applied on transactions by the issuer switch. Rules
  34. // can be filtered on API type and transaction type.
  35. rpc ListRules(ListRulesRequest) returns (ListRulesResponse) {
  36. option (google.api.http) = {
  37. get: "/v1/{parent=projects/*}/rules"
  38. };
  39. option (google.api.method_signature) = "parent";
  40. }
  41. // List all rule metadata for a given rule identifier.
  42. rpc ListRuleMetadata(ListRuleMetadataRequest) returns (ListRuleMetadataResponse) {
  43. option (google.api.http) = {
  44. get: "/v1/{parent=projects/*/rules/*}/metadata"
  45. };
  46. option (google.api.method_signature) = "parent";
  47. }
  48. // List all metadata values for a rule metadata identifier.
  49. rpc ListRuleMetadataValues(ListRuleMetadataValuesRequest) returns (ListRuleMetadataValuesResponse) {
  50. option (google.api.http) = {
  51. get: "/v1/{parent=projects/*/rules/*/metadata/*}/values"
  52. };
  53. option (google.api.method_signature) = "parent";
  54. }
  55. // Create (add) multiple values to the list of values under the specified rule
  56. // metadata resource.
  57. rpc BatchCreateRuleMetadataValues(BatchCreateRuleMetadataValuesRequest) returns (BatchCreateRuleMetadataValuesResponse) {
  58. option (google.api.http) = {
  59. post: "/v1/{parent=projects/*/rules/*/metadata/*}/values:batchCreate"
  60. body: "*"
  61. };
  62. option (google.api.method_signature) = "parent";
  63. }
  64. // Delete (remove) multiple values from the list of values under the specified
  65. // rules metadata resource.
  66. rpc BatchDeleteRuleMetadataValues(BatchDeleteRuleMetadataValuesRequest) returns (google.protobuf.Empty) {
  67. option (google.api.http) = {
  68. post: "/v1/{parent=projects/*/rules/*/metadata/*}/values:batchDelete"
  69. body: "*"
  70. };
  71. option (google.api.method_signature) = "parent";
  72. }
  73. }
  74. // A rule that is executed by the issuer switch while processing an
  75. // API transaction.
  76. message Rule {
  77. option (google.api.resource) = {
  78. type: "issuerswitch.googleapis.com/Rule"
  79. pattern: "projects/{project}/rules/{rule}"
  80. };
  81. // The unique identifier for this resource.
  82. // Format: projects/{project}/rules/{rule}
  83. string name = 1;
  84. // The description of the rule.
  85. string rule_description = 2;
  86. // The API Type for which this rule gets executed. A value of
  87. // `API_TYPE_UNSPECIFIED` indicates that the rule is executed for all API
  88. // transactions.
  89. ApiType api_type = 3;
  90. // The transaction type for which this rule gets executed. A value of
  91. // `TRANSACTION_TYPE_UNSPECIFIED` indicates that the rule is executed for
  92. // all transaction types.
  93. TransactionType transaction_type = 4;
  94. }
  95. // The metadata associated with a rule. This defines data that are used by the
  96. // rule during execution.
  97. message RuleMetadata {
  98. option (google.api.resource) = {
  99. type: "issuerswitch.googleapis.com/RuleMetadata"
  100. pattern: "projects/{project}/rules/{rule}/metadata/{metadata}"
  101. };
  102. // The type of metadata.
  103. enum Type {
  104. // Unspecified type.
  105. TYPE_UNSPECIFIED = 0;
  106. // List type. Indicates that the metadata contains a list of values which
  107. // the rule requires for execution.
  108. LIST = 1;
  109. }
  110. // The unique identifier for this resource.
  111. // Format: projects/{project}/rules/{rule}/metadata/{metadata}
  112. string name = 1;
  113. // The description of the rule metadata.
  114. string description = 2;
  115. // Type of rule metadata.
  116. Type type = 3;
  117. }
  118. // Represent a single value in a rule's metadata.
  119. message RuleMetadataValue {
  120. option (google.api.resource) = {
  121. type: "issuerswitch.googleapis.com/RuleMetadataValue"
  122. pattern: "projects/{project}/rules/{rule}/metadata/{metadata}/values/{value}"
  123. };
  124. // Output only. The unique identifier for this resource.
  125. // Format: projects/{project}/rules/{rule}/metadata/{metadata}/values/{value}
  126. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  127. // The value of the resource which could be of type string or
  128. // AccountReference. The metadata values for rules
  129. // BlockedPayeeAccountReqPayDebitRule, BlockedPayerAccountReqPayDebitRule,
  130. // BlockedPayeeAccountReqPayCreditRule and BlockedPayerAccountReqPayCreditRule
  131. // should be of type AccountReference. For all other rules, metadata values
  132. // should be of type string.
  133. //
  134. // The length of the `value` field depends on the type of
  135. // the value being used for the rule metadata. The following are the minimum
  136. // and maximum lengths for the different types of values.
  137. //
  138. // Value Type | Minimum Length | Maximum Length |
  139. // -------- | -------- | -------- |
  140. // Bank account IFSC | 11 | 11 |
  141. // Bank account number | 1 | 255 |
  142. // Device identifier | 1 | 255 |
  143. // Mobile number | 12 | 12 |
  144. // Virtual private address (VPA) | 3 | 255 |
  145. oneof value {
  146. // The value for string metadata.
  147. string id = 2;
  148. // The value for account reference metadata.
  149. AccountReference account_reference = 3;
  150. }
  151. }
  152. // Request body for the `ListRules` method.
  153. message ListRulesRequest {
  154. // Required. The parent resource must have the format of `projects/{project}`.
  155. string parent = 1 [
  156. (google.api.field_behavior) = REQUIRED,
  157. (google.api.resource_reference) = {
  158. child_type: "issuerswitch.googleapis.com/Rule"
  159. }
  160. ];
  161. // The maximum number of rules to return. The service may return fewer
  162. // than this value. If unspecified or if the specified value is less than 50,
  163. // at most 50 rules will be returned. The maximum value is 1000; values above
  164. // 1000 will be coerced to 1000.
  165. int32 page_size = 2;
  166. // A page token, received from a previous `ListRulesRequest` call.
  167. // Specify this parameter to retrieve the next page of rules.
  168. string page_token = 3;
  169. }
  170. // Response body for the `ListRules` method.
  171. message ListRulesResponse {
  172. // List of rules satisfying the specified filter criteria.
  173. repeated Rule rules = 1;
  174. // Pass this token in a subsequent `ListRulesRequest` call to continue to list
  175. // results. If all results have been returned, this field is an empty string
  176. // or not present in the response.
  177. string next_page_token = 2;
  178. // Total number of rules matching request criteria across all pages.
  179. int64 total_size = 3;
  180. }
  181. // Request body for the `ListRuleMetadata` method.
  182. message ListRuleMetadataRequest {
  183. // Required. The parent resource. The format is `projects/{project}/rules/{rule}`.
  184. string parent = 1 [
  185. (google.api.field_behavior) = REQUIRED,
  186. (google.api.resource_reference) = {
  187. child_type: "issuerswitch.googleapis.com/RuleMetadata"
  188. }
  189. ];
  190. // The maximum number of rule metadata to return. The service may return fewer
  191. // than this value. If unspecified or if the specified value is less than 50,
  192. // at most 50 rule metadata will be returned. The maximum value is 1000;
  193. // values above 1000 will be coerced to 1000.
  194. int32 page_size = 2;
  195. // A page token, received from a previous `ListRuleMetadataRequest` call.
  196. // Specify this parameter to retrieve the next page of rule metadata.
  197. string page_token = 3;
  198. }
  199. // Response body for the `ListRuleMetadata` method.
  200. message ListRuleMetadataResponse {
  201. // List of rule metadata associated with the rule.
  202. repeated RuleMetadata rule_metadata = 1;
  203. // Pass this token in a subsequent `ListRuleMetadataRequest` call to continue
  204. // to list results. If all results have been returned, this field is an empty
  205. // string or not present in the response.
  206. string next_page_token = 2;
  207. // Total number of rule metadata matching request criteria across all pages.
  208. int64 total_size = 3;
  209. }
  210. // Request body for the `ListRuleMetadataValues` method.
  211. message ListRuleMetadataValuesRequest {
  212. // Required. The parent resource. The format is
  213. // `projects/{project}/rules/{rule}/metadata/{metadata}`.
  214. string parent = 1 [
  215. (google.api.field_behavior) = REQUIRED,
  216. (google.api.resource_reference) = {
  217. child_type: "issuerswitch.googleapis.com/RuleMetadataValue"
  218. }
  219. ];
  220. // The maximum number of metadata values to return. The service may return
  221. // fewer than this value. If unspecified or if the specified value is less
  222. // than 1, at most 50 rule metadata values will be returned. The maximum
  223. // value is 1000; values above 1000 will be coerced to 1000.
  224. int32 page_size = 2;
  225. // A page token received from a previous `ListRuleMetadataValuesRequest`
  226. // call. Specify this parameter to retrieve the next page of rule metadata
  227. // values.
  228. string page_token = 3;
  229. }
  230. // Response body for ListRuleMetadataValues. Contains a List of values for a
  231. // given rule metadata resource.
  232. message ListRuleMetadataValuesResponse {
  233. // List of values for a given rule metadata resource identifier.
  234. repeated RuleMetadataValue rule_metadata_values = 1;
  235. // Pass this token in a subsequent `ListRuleMetadataValuesRequest` call to
  236. // continue to list results. If all results have been returned, this field is
  237. // an empty string or not present in the response.
  238. string next_page_token = 2;
  239. }
  240. // Request body for the `BatchCreateRuleMetadataValues` method.
  241. message BatchCreateRuleMetadataValuesRequest {
  242. // The parent resource shared by all ruleMetadataValue being created. The
  243. // format is `projects/{project}/rules/{rule}/metadata/{metadata}`. The
  244. // [CreateRuleMetadataValueRequest.parent][google.cloud.paymentgateway.issuerswitch.v1.CreateRuleMetadataValueRequest.parent] field in the
  245. // [CreateRuleMetadataValueRequest][google.cloud.paymentgateway.issuerswitch.v1.CreateRuleMetadataValueRequest] messages contained in this request must
  246. // match this field.
  247. string parent = 1 [(google.api.resource_reference) = {
  248. child_type: "issuerswitch.googleapis.com/RuleMetadataValue"
  249. }];
  250. // Required. The request message specifying the resources to create.
  251. // A maximum of 1000 RuleMetadataValues can be created in a batch.
  252. repeated CreateRuleMetadataValueRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
  253. }
  254. // Response body for the `BatchCreateRuleMetadataValues` method.
  255. message BatchCreateRuleMetadataValuesResponse {
  256. // List of RuleMetadataValue created.
  257. repeated RuleMetadataValue rule_metadata_value = 1;
  258. }
  259. // Request for creating a single `RuleMetadataValue`.
  260. message CreateRuleMetadataValueRequest {
  261. // Required. The parent resource where this RuleMetadataValue will be created. The
  262. // format is `projects/{project}/rules/{rule}/metadata/{metadata}`.
  263. string parent = 1 [
  264. (google.api.field_behavior) = REQUIRED,
  265. (google.api.resource_reference) = {
  266. child_type: "issuerswitch.googleapis.com/RuleMetadataValue"
  267. }
  268. ];
  269. // Required. The rule metadata value to create or add to a list.
  270. RuleMetadataValue rule_metadata_value = 2 [(google.api.field_behavior) = REQUIRED];
  271. }
  272. // Request body for the `BatchDeleteRuleMetadataValues` method.
  273. message BatchDeleteRuleMetadataValuesRequest {
  274. // The parent resource shared by all RuleMetadataValues being deleted. The
  275. // format is `projects/{project}/rules/{rule}/metadata/{metadata}`. If this is
  276. // set, the parent of all of the RuleMetadataValues specified in the
  277. // list of names must match this field.
  278. string parent = 1 [(google.api.resource_reference) = {
  279. child_type: "issuerswitch.googleapis.com/RuleMetadataValue"
  280. }];
  281. // Required. The names of the rule metadata values to delete.
  282. // A maximum of 1000 RuleMetadataValue can be deleted in a batch.
  283. // Format: projects/{project}/rules/{rule}/metadata/{metadata}/values/{value}
  284. repeated string names = 2 [
  285. (google.api.field_behavior) = REQUIRED,
  286. (google.api.resource_reference) = {
  287. type: "issuerswitch.googleapis.com/RuleMetadataValue"
  288. }
  289. ];
  290. }