1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.analytics.admin.v1alpha; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21 22option go_package = "cloud.google.com/go/analytics/admin/apiv1alpha/adminpb;adminpb"; 23option java_multiple_files = true; 24option java_package = "com.google.analytics.admin.v1alpha"; 25 26// Defines an event parameter to mutate. 27message ParameterMutation { 28 // Required. The name of the parameter to mutate. 29 // This value must: 30 // * be less than 40 characters. 31 // * be unique across across all mutations within the rule 32 // * consist only of letters, digits or _ (underscores) 33 // For event edit rules, the name may also be set to 'event_name' to modify 34 // the event_name in place. 35 string parameter = 1 [(google.api.field_behavior) = REQUIRED]; 36 37 // Required. The value mutation to perform. 38 // * Must be less than 100 characters. 39 // * To specify a constant value for the param, use the value's string. 40 // * To copy value from another parameter, use syntax like 41 // "[[other_parameter]]" For more details, see this [help center 42 // article](https://support.google.com/analytics/answer/10085872#modify-an-event&zippy=%2Cin-this-article%2Cmodify-parameters). 43 string parameter_value = 2 [(google.api.field_behavior) = REQUIRED]; 44} 45 46// An Event Create Rule defines conditions that will trigger the creation 47// of an entirely new event based upon matched criteria of a source event. 48// Additional mutations of the parameters from the source event can be defined. 49// 50// Unlike Event Edit rules, Event Creation Rules have no defined order. They 51// will all be run independently. 52// 53// Event Edit and Event Create rules can't be used to modify an event created 54// from an Event Create rule. 55message EventCreateRule { 56 option (google.api.resource) = { 57 type: "analyticsadmin.googleapis.com/EventCreateRule" 58 pattern: "properties/{property}/dataStreams/{data_stream}/eventCreateRules/{event_create_rule}" 59 }; 60 61 // Output only. Resource name for this EventCreateRule resource. 62 // Format: 63 // properties/{property}/dataStreams/{data_stream}/eventCreateRules/{event_create_rule} 64 string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; 65 66 // Required. The name of the new event to be created. 67 // 68 // This value must: 69 // * be less than 40 characters 70 // * consist only of letters, digits or _ (underscores) 71 // * start with a letter 72 string destination_event = 2 [(google.api.field_behavior) = REQUIRED]; 73 74 // Required. Must have at least one condition, and can have up to 10 max. 75 // Conditions on the source event must match for this rule to be applied. 76 repeated MatchingCondition event_conditions = 3 77 [(google.api.field_behavior) = REQUIRED]; 78 79 // If true, the source parameters are copied to the new event. 80 // If false, or unset, all non-internal parameters are not copied from the 81 // source event. Parameter mutations are applied after the parameters have 82 // been copied. 83 bool source_copy_parameters = 4; 84 85 // Parameter mutations define parameter behavior on the new event, and 86 // are applied in order. 87 // A maximum of 20 mutations can be applied. 88 repeated ParameterMutation parameter_mutations = 5; 89} 90 91// Defines a condition for when an Event Edit or Event Creation rule applies to 92// an event. 93message MatchingCondition { 94 // Comparison type for matching condition 95 enum ComparisonType { 96 // Unknown 97 COMPARISON_TYPE_UNSPECIFIED = 0; 98 99 // Equals, case sensitive 100 EQUALS = 1; 101 102 // Equals, case insensitive 103 EQUALS_CASE_INSENSITIVE = 2; 104 105 // Contains, case sensitive 106 CONTAINS = 3; 107 108 // Contains, case insensitive 109 CONTAINS_CASE_INSENSITIVE = 4; 110 111 // Starts with, case sensitive 112 STARTS_WITH = 5; 113 114 // Starts with, case insensitive 115 STARTS_WITH_CASE_INSENSITIVE = 6; 116 117 // Ends with, case sensitive 118 ENDS_WITH = 7; 119 120 // Ends with, case insensitive 121 ENDS_WITH_CASE_INSENSITIVE = 8; 122 123 // Greater than 124 GREATER_THAN = 9; 125 126 // Greater than or equal 127 GREATER_THAN_OR_EQUAL = 10; 128 129 // Less than 130 LESS_THAN = 11; 131 132 // Less than or equal 133 LESS_THAN_OR_EQUAL = 12; 134 135 // regular expression. Only supported for web streams. 136 REGULAR_EXPRESSION = 13; 137 138 // regular expression, case insensitive. Only supported for web streams. 139 REGULAR_EXPRESSION_CASE_INSENSITIVE = 14; 140 } 141 142 // Required. The name of the field that is compared against for the condition. 143 // If 'event_name' is specified this condition will apply to the name of the 144 // event. Otherwise the condition will apply to a parameter with the 145 // specified name. 146 // 147 // This value cannot contain spaces. 148 string field = 1 [(google.api.field_behavior) = REQUIRED]; 149 150 // Required. The type of comparison to be applied to the value. 151 ComparisonType comparison_type = 2 [(google.api.field_behavior) = REQUIRED]; 152 153 // Required. The value being compared against for this condition. The runtime 154 // implementation may perform type coercion of this value to evaluate this 155 // condition based on the type of the parameter value. 156 string value = 3 [(google.api.field_behavior) = REQUIRED]; 157 158 // Whether or not the result of the comparison should be negated. For example, 159 // if `negated` is true, then 'equals' comparisons would function as 'not 160 // equals'. 161 bool negated = 4; 162} 163