Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etcdserver: improve Lease http path naming for gRPC gateway #9450

Merged
merged 1 commit into from
Mar 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG-3.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ See [security doc](https://github.com/coreos/etcd/blob/master/Documentation/op-g
- Replace [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) `/v3beta` with [`/v3`](https://github.com/coreos/etcd/pull/9298).
- Deprecated [`/v3alpha`](https://github.com/coreos/etcd/pull/9298).
- To deprecate [`/v3beta`](https://github.com/coreos/etcd/issues/9189) in `v3.5`.
- Add API endpoints [`/{v3,v3beta}/lease/leases, /{v3,v3beta}/lease/revoke /{v3,v3beta}/lease/timetolive`](https://github.com/coreos/etcd/pull/9450).
- To deprecate [`/{v3,v3beta}/kv/lease/leases, /{v3,v3beta}/kv/lease/revoke, /{v3,v3beta}/kv/lease/timetolive`](https://github.com/coreos/etcd/issues/9430) in `v3.5`.

### Package `raft`

Expand Down
87 changes: 84 additions & 3 deletions Documentation/dev-guide/apispec/swagger/rpc.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@
"Lease"
],
"summary": "LeaseLeases lists all existing leases.",
"operationId": "LeaseLeases",
"operationId": "LeaseLeases2",
"parameters": [
{
"name": "body",
Expand All @@ -642,7 +642,7 @@
"Lease"
],
"summary": "LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.",
"operationId": "LeaseRevoke",
"operationId": "LeaseRevoke2",
"parameters": [
{
"name": "body",
Expand All @@ -669,7 +669,7 @@
"Lease"
],
"summary": "LeaseTimeToLive retrieves lease information.",
"operationId": "LeaseTimeToLive",
"operationId": "LeaseTimeToLive2",
"parameters": [
{
"name": "body",
Expand Down Expand Up @@ -826,6 +826,87 @@
}
}
},
"/v3/lease/leases": {
"post": {
"tags": [
"Lease"
],
"summary": "LeaseLeases lists all existing leases.",
"operationId": "LeaseLeases",
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseLeasesRequest"
}
}
],
"responses": {
"200": {
"description": "(empty)",
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseLeasesResponse"
}
}
}
}
},
"/v3/lease/revoke": {
"post": {
"tags": [
"Lease"
],
"summary": "LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.",
"operationId": "LeaseRevoke",
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseRevokeRequest"
}
}
],
"responses": {
"200": {
"description": "(empty)",
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseRevokeResponse"
}
}
}
}
},
"/v3/lease/timetolive": {
"post": {
"tags": [
"Lease"
],
"summary": "LeaseTimeToLive retrieves lease information.",
"operationId": "LeaseTimeToLive",
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseTimeToLiveRequest"
}
}
],
"responses": {
"200": {
"description": "(empty)",
"schema": {
"$ref": "#/definitions/etcdserverpbLeaseTimeToLiveResponse"
}
}
}
}
},
"/v3/maintenance/alarm": {
"post": {
"tags": [
Expand Down
19 changes: 18 additions & 1 deletion e2e/v3_curl_lease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type v3cURLTest struct {
expected string
}

// TODO remove /kv/lease/timetolive, /kv/lease/revoke, /kv/lease/leases tests in 3.5 release

func testV3CurlLeaseGrant(cx ctlCtx) {
leaseID := randomLeaseID()

Expand All @@ -67,6 +69,11 @@ func testV3CurlLeaseGrant(cx ctlCtx) {
value: gwKVPutLease(cx, "foo", "bar", leaseID),
expected: `"revision":"`,
},
{
endpoint: "/lease/timetolive",
value: gwLeaseTTLWithKeys(cx, leaseID),
expected: `"grantedTTL"`,
},
{
endpoint: "/kv/lease/timetolive",
value: gwLeaseTTLWithKeys(cx, leaseID),
Expand All @@ -88,10 +95,15 @@ func testV3CurlLeaseRevoke(cx ctlCtx) {
expected: gwLeaseIDExpected(leaseID),
},
{
endpoint: "/kv/lease/revoke",
endpoint: "/lease/revoke",
value: gwLeaseRevoke(cx, leaseID),
expected: `"revision":"`,
},
{
endpoint: "/kv/lease/revoke",
value: gwLeaseRevoke(cx, leaseID),
expected: `etcdserver: requested lease not found`,
},
}
if err := cURLWithExpected(cx, tests); err != nil {
cx.t.Fatalf("testV3CurlLeaseRevoke: %v", err)
Expand All @@ -107,6 +119,11 @@ func testV3CurlLeaseLeases(cx ctlCtx) {
value: gwLeaseGrant(cx, leaseID, 0),
expected: gwLeaseIDExpected(leaseID),
},
{
endpoint: "/lease/leases",
value: "{}",
expected: gwLeaseIDExpected(leaseID),
},
{
endpoint: "/kv/lease/leases",
value: "{}",
Expand Down
144 changes: 141 additions & 3 deletions etcdserver/etcdserverpb/gw/rpc.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading