syntax = "proto3";

package docker;

option go_package = "waypoint/builtin/docker";

import "google/protobuf/empty.proto";

import "any.proto";

// Image is the artifact type for the registry.
message Image {
  string image = 1;
  string tag = 2;
  string architecture = 6;

  // location is where this image is currently. This can be used to
  // determine if the image is pulled or not based on this proto rather
  // than environment inspection.
  //
  // If this is not set, it will be assumed that the image is in a local
  // Docker daemon registry for backwards compatiblity reasons.
  oneof location {
    // registry is set if the image is in a remote registry. This value
    // might mean the image is local, too, but we never formally "pulled"
    // it so we aren't sure. The image should be treated as remote.
    RegistryLocation registry = 3;

    // docker is set if the image is in a local Docker daemon registry.
    google.protobuf.Empty docker = 4;

    // Waypoint 0.6 and earlier supported "img" as a Dockerless builder.
    // We removed this in 0.7, hence we prefix this now with "unused". We
    // keep the field around so we can detect old clients sending it and
    // show an error. Do not set this.
    google.protobuf.Empty unused_img = 5;
  }

  message RegistryLocation {
    // waypoint_generated indicates that the Image was generated by a process
    // that resulted in the fully built image being already stored in the
    // registry. This is commonly done in ODR for pack and docker-build.
    bool waypoint_generated = 1;
  }
}

message Deployment {
  string id = 1;
  string name = 2;
  string container = 3;
  opaqueany.Any resource_state = 4;
}

message Release {
  string url = 1;
}

// Resource contains the internal resource states.
message Resource {
  message Network {
    string name = 1;
  }

  message Container {
    string id = 1;
    string name = 2;
  }
}

message TaskInfo {
  string id = 1;
}

message AccessInfo {
  // image is the OCI compatible descriptor for the location of the image. Typically it
  // is in the form `repo/name`, where repo is a host name (perhaps with a port), and
  // name may also contain / use to identify subdivision on the host.
  string image = 1;

  // tag is the OCI compatible tag that the resulting data will be stored at within
  // the repository defined by image.
  string tag = 2;

  // auth indicates how to authenticate with the repository defined by image.
  oneof auth {

    // header is the value of the Authentication header that is sent to the repository.
    // This allows for repositories that use bearer tokens or other sorts of authentication.
    string header = 3;

    // encoded is the docker standard encoded authentication data. This is base64 encoded
    // json that contains username and passwword fields that are used for authentication.
    string encoded = 4;

    // user_pass specifies a username and password to use to authenticate with the registry.
    // The registry plugin will transform this information to the proper format as needed.
    UserPass user_pass = 6;

  }

  // insecure indicates if the repository defined by image should be access via http or https.
  bool insecure = 5;

  message UserPass {
    // The username to authenticate against the registry with
    string username = 1;

    // The password assocated with the above username
    string password = 2;
  }
}
