xref: /aosp_15_r20/external/googleapis/google/cloud/gkehub/v1beta/feature.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
15syntax = "proto3";
16
17package google.cloud.gkehub.v1beta;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/gkehub/v1beta/configmanagement/configmanagement.proto";
22import "google/cloud/gkehub/v1beta/metering/metering.proto";
23import "google/cloud/gkehub/v1beta/multiclusteringress/multiclusteringress.proto";
24import "google/protobuf/timestamp.proto";
25
26option csharp_namespace = "Google.Cloud.GkeHub.V1Beta";
27option go_package = "cloud.google.com/go/gkehub/apiv1beta/gkehubpb;gkehubpb";
28option java_multiple_files = true;
29option java_outer_classname = "FeatureProto";
30option java_package = "com.google.cloud.gkehub.v1beta";
31option php_namespace = "Google\\Cloud\\GkeHub\\V1beta";
32option ruby_package = "Google::Cloud::GkeHub::V1beta";
33
34// Feature represents the settings and status of any Hub Feature.
35message Feature {
36  option (google.api.resource) = {
37    type: "gkehub.googleapis.com/Feature"
38    pattern: "projects/{project}/locations/{location}/features/{feature}"
39  };
40
41  // Output only. The full, unique name of this Feature resource in the format
42  // `projects/*/locations/*/features/*`.
43  string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
44
45  // GCP labels for this Feature.
46  map<string, string> labels = 2;
47
48  // Output only. State of the Feature resource itself.
49  FeatureResourceState resource_state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
50
51  // Optional. Hub-wide Feature configuration. If this Feature does not support any
52  // Hub-wide configuration, this field may be unused.
53  CommonFeatureSpec spec = 4 [(google.api.field_behavior) = OPTIONAL];
54
55  // Optional. Membership-specific configuration for this Feature. If this Feature does
56  // not support any per-Membership configuration, this field may be unused.
57  //
58  // The keys indicate which Membership the configuration is for, in the form:
59  //
60  //     projects/{p}/locations/{l}/memberships/{m}
61  //
62  // Where {p} is the project, {l} is a valid location and {m} is a valid
63  // Membership in this project at that location. {p} WILL match the Feature's
64  // project.
65  //
66  // {p} will always be returned as the project number, but the project ID is
67  // also accepted during input. If the same Membership is specified in the map
68  // twice (using the project ID form, and the project number form), exactly
69  // ONE of the entries will be saved, with no guarantees as to which. For this
70  // reason, it is recommended the same format be used for all entries when
71  // mutating a Feature.
72  map<string, MembershipFeatureSpec> membership_specs = 5 [(google.api.field_behavior) = OPTIONAL];
73
74  // Output only. The Hub-wide Feature state.
75  CommonFeatureState state = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
76
77  // Output only. Membership-specific Feature status. If this Feature does
78  // report any per-Membership status, this field may be unused.
79  //
80  // The keys indicate which Membership the state is for, in the form:
81  //
82  //     projects/{p}/locations/{l}/memberships/{m}
83  //
84  // Where {p} is the project number, {l} is a valid location and {m} is a valid
85  // Membership in this project at that location. {p} MUST match the Feature's
86  // project number.
87  map<string, MembershipFeatureState> membership_states = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
88
89  // Output only. When the Feature resource was created.
90  google.protobuf.Timestamp create_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
91
92  // Output only. When the Feature resource was last updated.
93  google.protobuf.Timestamp update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY];
94
95  // Output only. When the Feature resource was deleted.
96  google.protobuf.Timestamp delete_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
97}
98
99// FeatureResourceState describes the state of a Feature *resource* in the
100// GkeHub API. See `FeatureState` for the "running state" of the Feature in the
101// Hub and across Memberships.
102message FeatureResourceState {
103  // State describes the lifecycle status of a Feature.
104  enum State {
105    // State is unknown or not set.
106    STATE_UNSPECIFIED = 0;
107
108    // The Feature is being enabled, and the Feature resource is being created.
109    // Once complete, the corresponding Feature will be enabled in this Hub.
110    ENABLING = 1;
111
112    // The Feature is enabled in this Hub, and the Feature resource is fully
113    // available.
114    ACTIVE = 2;
115
116    // The Feature is being disabled in this Hub, and the Feature resource
117    // is being deleted.
118    DISABLING = 3;
119
120    // The Feature resource is being updated.
121    UPDATING = 4;
122
123    // The Feature resource is being updated by the Hub Service.
124    SERVICE_UPDATING = 5;
125  }
126
127  // The current state of the Feature resource in the Hub API.
128  State state = 1;
129}
130
131// FeatureState describes the high-level state of a Feature. It may be used to
132// describe a Feature's state at the environ-level, or per-membershop, depending
133// on the context.
134message FeatureState {
135  // Code represents a machine-readable, high-level status of the Feature.
136  enum Code {
137    // Unknown or not set.
138    CODE_UNSPECIFIED = 0;
139
140    // The Feature is operating normally.
141    OK = 1;
142
143    // The Feature has encountered an issue, and is operating in a degraded
144    // state. The Feature may need intervention to return to normal operation.
145    // See the description and any associated Feature-specific details for more
146    // information.
147    WARNING = 2;
148
149    // The Feature is not operating or is in a severely degraded state.
150    // The Feature may need intervention to return to normal operation.
151    // See the description and any associated Feature-specific details for more
152    // information.
153    ERROR = 3;
154  }
155
156  // The high-level, machine-readable status of this Feature.
157  Code code = 1;
158
159  // A human-readable description of the current status.
160  string description = 2;
161
162  // The time this status and any related Feature-specific details were updated.
163  google.protobuf.Timestamp update_time = 3;
164}
165
166// CommonFeatureSpec contains Hub-wide configuration information
167message CommonFeatureSpec {
168  oneof feature_spec {
169    // Multicluster Ingress-specific spec.
170    google.cloud.gkehub.multiclusteringress.v1beta.FeatureSpec multiclusteringress = 102;
171  }
172}
173
174// CommonFeatureState contains Hub-wide Feature status information.
175message CommonFeatureState {
176  // Output only. The "running state" of the Feature in this Hub.
177  FeatureState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
178}
179
180// MembershipFeatureSpec contains configuration information for a single
181// Membership.
182message MembershipFeatureSpec {
183  oneof feature_spec {
184    // Config Management-specific spec.
185    google.cloud.gkehub.configmanagement.v1beta.MembershipSpec configmanagement = 106;
186  }
187}
188
189// MembershipFeatureState contains Feature status information for a single
190// Membership.
191message MembershipFeatureState {
192  oneof feature_state {
193    // Metering-specific spec.
194    google.cloud.gkehub.metering.v1beta.MembershipState metering = 104;
195
196    // Config Management-specific state.
197    google.cloud.gkehub.configmanagement.v1beta.MembershipState configmanagement = 106;
198  }
199
200  // The high-level state of this Feature for a single membership.
201  FeatureState state = 1;
202}
203