syntax = "proto3";
option go_package = "github.com/argoproj/argo-cd/v2/pkg/apiclient/applicationset";


// ApplicationSet Service
//
// ApplicationSet Service API performs CRUD actions against applicationset resources
package applicationset;

import "google/api/annotations.proto";
import "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/generated.proto";

// ApplicationSetGetQuery is a query for applicationset resources
message ApplicationSetGetQuery {
	// the applicationsets's name
	string name = 1;
}

message ApplicationSetListQuery {
	// the project names to restrict returned list applicationsets
	repeated string projects = 1;
	// the selector to restrict returned list to applications only with matched labels
	string selector = 2;
}


message ApplicationSetResponse {
	string project = 1;
	github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSet applicationset = 2;
}


message ApplicationSetCreateRequest {
	github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSet applicationset = 1;
	bool upsert = 2;
}


message ApplicationSetDeleteRequest {
	string name = 1;
}


// ApplicationSetService
service ApplicationSetService {
	
	// Get returns an applicationset by name
	rpc Get (ApplicationSetGetQuery) returns (github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSet) {
		option (google.api.http).get = "/api/v1/applicationsets/{name}";
	}

	//List returns list of applicationset
	rpc List (ApplicationSetListQuery) returns (github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSetList) {
		option (google.api.http).get = "/api/v1/applicationsets";
	}

	//Create creates an applicationset
	rpc Create (ApplicationSetCreateRequest) returns (github.com.argoproj.argo_cd.v2.pkg.apis.application.v1alpha1.ApplicationSet) {
		option (google.api.http) = {
			post: "/api/v1/applicationsets"
			body: "applicationset"
		};
	}

	// Delete deletes an application set
	rpc Delete(ApplicationSetDeleteRequest) returns (ApplicationSetResponse) {
		option (google.api.http).delete = "/api/v1/applicationsets/{name}";
	}

}