// Copyright 2020 Google LLC
//
// 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 google.devtools.artifactregistry.v1beta2;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option csharp_namespace = "Google.Cloud.ArtifactRegistry.V1Beta2";
option go_package = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2;artifactregistry";
option java_multiple_files = true;
option java_outer_classname = "ArtifactProto";
option java_package = "com.google.devtools.artifactregistry.v1beta2";
option php_namespace = "Google\\Cloud\\ArtifactRegistry\\V1beta2";

// DockerImage represents a docker artifact.
message DockerImage {
  option (google.api.resource) = {
    type: "artifactregistry.googleapis.com/DockerImage"
    pattern: "projects/{project}/locations/{location}/repositories/{repository}/dockerImages/{docker_image}"
  };

  // Required. registry_location, project_id, repository_name and image id forms a unique
  // image
  // name:`projects/<project_id>/locations/<location>/repository/<repository_name>/dockerimages/<image>`.
  // For example,
  // "projects/test-project/locations/us-west4/repositories/test-repo/dockerimages/
  // nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf",
  // where "us-west4" is the registry_location, "test-project" is the
  // project_id, "test-repo" is the repository_name and
  // "nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf"
  // is the image's digest.
  string name = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. URL to access the image.
  // Example:
  // us-west4-docker.pkg.dev/test-project/test-repo/nginx@sha256:e9954c1fc875017be1c3e36eca16be2d9e9bccc4bf072163515467d6a823c7cf
  string uri = 2 [(google.api.field_behavior) = REQUIRED];

  // Tags attached to this image.
  repeated string tags = 3;

  // Calculated size of the image.
  int64 image_size_bytes = 4;

  // Time the image was uploaded.
  google.protobuf.Timestamp upload_time = 5;

  // Media type of this image, e.g.
  // "application/vnd.docker.distribution.manifest.v2+json".
  string media_type = 6;
}

// The request to list docker images.
message ListDockerImagesRequest {
  // Required. The name of the parent resource whose docker images will be listed.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "artifactregistry.googleapis.com/DockerImage"
    }
  ];

  // The maximum number of artifacts to return.
  int32 page_size = 2;

  // The next_page_token value returned from a previous list request, if any.
  string page_token = 3;
}

// The response from listing docker images.
message ListDockerImagesResponse {
  // The docker images returned.
  repeated DockerImage docker_images = 1;

  // The token to retrieve the next page of artifacts, or empty if there are no
  // more artifacts to return.
  string next_page_token = 2;
}
