// Copyright 2018 Istio Authors
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

syntax = "proto3";

package istio.mcp.v1alpha1;

import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package="istio.io/api/mcp/v1alpha1";
option (gogoproto.equal_all) = true;

// Metadata information that all resources within the Mesh Configuration Protocol must have.
message Metadata {
  // Fully qualified name of the resource. Unique in context of a collection.
  //
  // The fully qualified name consists of a directory and basename. The directory identifies
  // the resources location in a resource hierarchy. The basename identifies the specific
  // resource name within the context of that directory.
  //
  // The directory and basename are composed of one or more segments. Segments must be
  // valid [DNS labels](https://tools.ietf.org/html/rfc1123). "/" is the delimiter between
  // segments
  //
  // The rightmost segment is the basename. All segments to the
  // left of the basename form the directory. Segments moving towards the left
  // represent higher positions in the resource hierarchy, similar to reverse
  // DNS notation. e.g.
  //
  //    /<org>/<team>/<subteam>/<resource basename>
  //
  // An empty directory indicates a resource that is located at the root of the
  // hierarchy, e.g.
  //
  //    /<globally scoped resource>
  //
  // On Kubernetes the resource hierarchy is two-levels: namespaces and
  // cluster-scoped (i.e. global).
  //
  // Namespace resources fully qualified name is of the form:
  //
  //    "<k8s namespace>/<k8s resource name>"
  //
  // Cluster scoped resources are located at the root of the hierarchy and are of the form:
  //
  //    "/<k8s resource name>"
  string name = 1;

  // The creation timestamp of the resource.
  google.protobuf.Timestamp create_time = 2;

  // Resource version. This is used to determine when resources change across
  // resource updates. It should be treated as opaque by consumers/sinks.
  string version = 3;

  // Map of string keys and values that can be used to organize and categorize
  // resources within a collection.
  map<string,string> labels = 4;

  // Map of string keys and values that can be used by source and sink to communicate
  // arbitrary metadata about this resource.
  map<string,string> annotations = 5;
}
