github.com/google/cadvisor@v0.49.1/third_party/containerd/api/services/leases/v1/leases.proto (about)

     1  /*
     2  	Copyright The containerd Authors.
     3  
     4  	Licensed under the Apache License, Version 2.0 (the "License");
     5  	you may not use this file except in compliance with the License.
     6  	You may obtain a copy of the License at
     7  
     8  		http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  	Unless required by applicable law or agreed to in writing, software
    11  	distributed under the License is distributed on an "AS IS" BASIS,
    12  	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  	See the License for the specific language governing permissions and
    14  	limitations under the License.
    15  */
    16  syntax = "proto3";
    17  
    18  package containerd.services.leases.v1;
    19  
    20  import weak "gogoproto/gogo.proto";
    21  import "google/protobuf/empty.proto";
    22  import "google/protobuf/timestamp.proto";
    23  
    24  option go_package = "github.com/containerd/containerd/api/services/leases/v1;leases";
    25  
    26  // Leases service manages resources leases within the metadata store.
    27  service Leases {
    28  	// Create creates a new lease for managing changes to metadata. A lease
    29  	// can be used to protect objects from being removed.
    30  	rpc Create(CreateRequest) returns (CreateResponse);
    31  
    32  	// Delete deletes the lease and makes any unreferenced objects created
    33  	// during the lease eligible for garbage collection if not referenced
    34  	// or retained by other resources during the lease.
    35  	rpc Delete(DeleteRequest) returns (google.protobuf.Empty);
    36  
    37  	// List lists all active leases, returning the full list of
    38  	// leases and optionally including the referenced resources.
    39  	rpc List(ListRequest) returns (ListResponse);
    40  
    41  	// AddResource references the resource by the provided lease.
    42  	rpc AddResource(AddResourceRequest) returns (google.protobuf.Empty);
    43  
    44  	// DeleteResource dereferences the resource by the provided lease.
    45  	rpc DeleteResource(DeleteResourceRequest) returns (google.protobuf.Empty);
    46  
    47  	// ListResources lists all the resources referenced by the lease.
    48  	rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse);
    49  }
    50  
    51  // Lease is an object which retains resources while it exists.
    52  message Lease {
    53  	string id = 1;
    54  
    55  	google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
    56  
    57  	map<string, string> labels = 3;
    58  }
    59  
    60  message CreateRequest {
    61  	// ID is used to identity the lease, when the id is not set the service
    62  	// generates a random identifier for the lease.
    63  	string id = 1;
    64  
    65  	map<string, string> labels = 3;
    66  }
    67  
    68  message CreateResponse {
    69  	Lease lease = 1;
    70  }
    71  
    72  message DeleteRequest {
    73  	string id = 1;
    74  
    75  	// Sync indicates that the delete and cleanup should be done
    76  	// synchronously before returning to the caller
    77  	//
    78  	// Default is false
    79  	bool sync = 2;
    80  }
    81  
    82  message ListRequest {
    83  	repeated string filters = 1;
    84  }
    85  
    86  message ListResponse {
    87  	repeated Lease leases = 1;
    88  }
    89  
    90  message Resource {
    91  	string id = 1;
    92  
    93  	// For snapshotter resource, there are many snapshotter types here, like
    94  	// overlayfs, devmapper etc. The type will be formatted with type,
    95  	// like "snapshotter/overlayfs".
    96  	string type = 2;
    97  }
    98  
    99  message AddResourceRequest {
   100  	string id = 1;
   101  
   102  	Resource resource = 2 [(gogoproto.nullable) = false];
   103  }
   104  
   105  message DeleteResourceRequest {
   106  	string id = 1;
   107  
   108  	Resource resource = 2 [(gogoproto.nullable) = false];
   109  }
   110  
   111  message ListResourcesRequest {
   112  	string id = 1;
   113  }
   114  
   115  message ListResourcesResponse {
   116  	repeated Resource resources = 1	[(gogoproto.nullable) = false];
   117  }