Skip to content

Commit 764382d

Browse files
committed
16.13.0
1 parent 8112162 commit 764382d

22 files changed

Lines changed: 15793 additions & 1 deletion

com/strongdm/api/Client.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,36 @@ public DiscoveryConnectors discoveryConnectors() {
241241
return this.discoveryConnectors;
242242
}
243243

244+
protected final GrantedAccountEntitlements grantedAccountEntitlements;
245+
246+
/**
247+
* GrantedAccountEntitlements enumerates the resources to which an account has been granted
248+
* access. The GrantedAccountEntitlements service is read-only.
249+
*/
250+
public GrantedAccountEntitlements grantedAccountEntitlements() {
251+
return this.grantedAccountEntitlements;
252+
}
253+
254+
protected final GrantedResourceEntitlements grantedResourceEntitlements;
255+
256+
/**
257+
* GrantedResourceEntitlements enumerates the accounts that have been granted access to a given
258+
* resource. The GrantedResourceEntitlements service is read-only.
259+
*/
260+
public GrantedResourceEntitlements grantedResourceEntitlements() {
261+
return this.grantedResourceEntitlements;
262+
}
263+
264+
protected final GrantedRoleEntitlements grantedRoleEntitlements;
265+
266+
/**
267+
* GrantedRoleEntitlements enumerates the resources to which a role grants access. The
268+
* GrantedRoleEntitlements service is read-only.
269+
*/
270+
public GrantedRoleEntitlements grantedRoleEntitlements() {
271+
return this.grantedRoleEntitlements;
272+
}
273+
244274
protected final Roles roles;
245275

246276
/**
@@ -649,6 +679,9 @@ private Client(Client client) {
649679
this.approvalWorkflowsHistory = new ApprovalWorkflowsHistory(this.channel, this);
650680
this.controlPanel = new ControlPanel(this.channel, this);
651681
this.discoveryConnectors = new DiscoveryConnectors(this.channel, this);
682+
this.grantedAccountEntitlements = new GrantedAccountEntitlements(this.channel, this);
683+
this.grantedResourceEntitlements = new GrantedResourceEntitlements(this.channel, this);
684+
this.grantedRoleEntitlements = new GrantedRoleEntitlements(this.channel, this);
652685
this.roles = new Roles(this.channel, this);
653686
this.groups = new Groups(this.channel, this);
654687
this.groupsHistory = new GroupsHistory(this.channel, this);
@@ -737,6 +770,9 @@ public Client(String apiAccessKey, String apiSecretKey, ClientOptions options)
737770
this.approvalWorkflowsHistory = new ApprovalWorkflowsHistory(this.channel, this);
738771
this.controlPanel = new ControlPanel(this.channel, this);
739772
this.discoveryConnectors = new DiscoveryConnectors(this.channel, this);
773+
this.grantedAccountEntitlements = new GrantedAccountEntitlements(this.channel, this);
774+
this.grantedResourceEntitlements = new GrantedResourceEntitlements(this.channel, this);
775+
this.grantedRoleEntitlements = new GrantedRoleEntitlements(this.channel, this);
740776
this.roles = new Roles(this.channel, this);
741777
this.groups = new Groups(this.channel, this);
742778
this.groupsHistory = new GroupsHistory(this.channel, this);
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright 2020 StrongDM Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
// Code generated by protogen. DO NOT EDIT.
17+
18+
package com.strongdm.api;
19+
20+
import java.util.Date;
21+
22+
/**
23+
* GrantedAccountEntitlement represents an individual entitlement of an Account to a Resource that
24+
* has been granted.
25+
*/
26+
public class GrantedAccountEntitlement {
27+
private String groupId;
28+
/** The unique identifier of the group associated with this entitlement, if any. */
29+
public String getGroupId() {
30+
return this.groupId;
31+
}
32+
/** The unique identifier of the group associated with this entitlement, if any. */
33+
public void setGroupId(String in) {
34+
this.groupId = in;
35+
}
36+
37+
private Date lastAccessed;
38+
/**
39+
* The most recent time at which the account accessed this resource. Empty if the resource has
40+
* never been accessed.
41+
*/
42+
public Date getLastAccessed() {
43+
return this.lastAccessed;
44+
}
45+
/**
46+
* The most recent time at which the account accessed this resource. Empty if the resource has
47+
* never been accessed.
48+
*/
49+
public void setLastAccessed(Date in) {
50+
this.lastAccessed = in;
51+
}
52+
53+
private MappedIdentities mappedIdentities;
54+
/** The mapped identity privileges for this entitlement, such as Kubernetes group memberships. */
55+
public MappedIdentities getMappedIdentities() {
56+
return this.mappedIdentities;
57+
}
58+
/** The mapped identity privileges for this entitlement, such as Kubernetes group memberships. */
59+
public void setMappedIdentities(MappedIdentities in) {
60+
this.mappedIdentities = in;
61+
}
62+
63+
private String originId;
64+
/** The unique identifier of the origin of this entitlement (e.g., a Role or AccountGrant ID). */
65+
public String getOriginId() {
66+
return this.originId;
67+
}
68+
/** The unique identifier of the origin of this entitlement (e.g., a Role or AccountGrant ID). */
69+
public void setOriginId(String in) {
70+
this.originId = in;
71+
}
72+
73+
private String resourceId;
74+
/** The unique identifier of the Resource to which access is granted. */
75+
public String getResourceId() {
76+
return this.resourceId;
77+
}
78+
/** The unique identifier of the Resource to which access is granted. */
79+
public void setResourceId(String in) {
80+
this.resourceId = in;
81+
}
82+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// Copyright 2020 StrongDM Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
// Code generated by protogen. DO NOT EDIT.
17+
18+
package com.strongdm.api;
19+
20+
import com.strongdm.api.plumbing.GrantedAccountEntitlementsGrpc;
21+
import com.strongdm.api.plumbing.GrantedAccountEntitlementsPlumbing;
22+
import com.strongdm.api.plumbing.PageIterator;
23+
import com.strongdm.api.plumbing.PageResult;
24+
import com.strongdm.api.plumbing.Plumbing;
25+
import com.strongdm.api.plumbing.Spec.ListRequestMetadata;
26+
import io.grpc.Deadline;
27+
import io.grpc.ManagedChannel;
28+
import java.util.Iterator;
29+
import java.util.List;
30+
import java.util.concurrent.TimeUnit;
31+
import java.util.function.Supplier;
32+
33+
/**
34+
* GrantedAccountEntitlements enumerates the resources to which an account has been granted access.
35+
* The GrantedAccountEntitlements service is read-only.
36+
*/
37+
public class GrantedAccountEntitlements implements SnapshotGrantedAccountEntitlements {
38+
private final GrantedAccountEntitlementsGrpc.GrantedAccountEntitlementsBlockingStub stub;
39+
private final Client parent;
40+
private final Deadline deadline;
41+
42+
public GrantedAccountEntitlements(ManagedChannel channel, Client client) {
43+
this.stub = GrantedAccountEntitlementsGrpc.newBlockingStub(channel);
44+
this.parent = client;
45+
this.deadline = null;
46+
}
47+
48+
private GrantedAccountEntitlements(
49+
GrantedAccountEntitlementsGrpc.GrantedAccountEntitlementsBlockingStub stub,
50+
Client client,
51+
Deadline deadline) {
52+
this.stub = stub;
53+
this.parent = client;
54+
this.deadline = deadline;
55+
}
56+
57+
/**
58+
* This function returns a copy of the GrantedAccountEntitlements service which has the given
59+
* deadline set for all method calls.
60+
*/
61+
public GrantedAccountEntitlements withDeadlineAfter(long duration, TimeUnit units) {
62+
Deadline deadline = Deadline.after(duration, units);
63+
return new GrantedAccountEntitlements(this.stub.withDeadline(deadline), this.parent, deadline);
64+
}
65+
/** List gets a list of GrantedAccountEntitlement records matching a given set of criteria. */
66+
public Iterable<GrantedAccountEntitlement> list(String accountId, String filter, Object... args)
67+
throws RpcException {
68+
GrantedAccountEntitlementsPlumbing.GrantedAccountEntitlementListRequest.Builder builder =
69+
GrantedAccountEntitlementsPlumbing.GrantedAccountEntitlementListRequest.newBuilder();
70+
builder.setAccountId((accountId));
71+
builder.setFilter(Plumbing.quoteFilterArgs(filter, args));
72+
ListRequestMetadata.Builder metaBuilder = ListRequestMetadata.newBuilder();
73+
if (this.parent.pageLimit > 0) {
74+
metaBuilder.setLimit(this.parent.pageLimit);
75+
}
76+
if (this.parent.snapshotDate != null) {
77+
metaBuilder.setSnapshotAt(Plumbing.convertTimestampToPlumbing(this.parent.snapshotDate));
78+
}
79+
builder.setMeta(metaBuilder);
80+
81+
Supplier<PageResult<GrantedAccountEntitlement>> pageFetcher =
82+
() -> {
83+
// Note: this closure captures and reuses the builder to set the next page
84+
GrantedAccountEntitlementsPlumbing.GrantedAccountEntitlementListRequest req =
85+
builder.build();
86+
GrantedAccountEntitlementsPlumbing.GrantedAccountEntitlementListResponse plumbingResponse;
87+
int tries = 0;
88+
while (true) {
89+
try {
90+
plumbingResponse =
91+
this.stub
92+
.withCallCredentials(
93+
this.parent.getCallCredentials("GrantedAccountEntitlements.List", req))
94+
.list(req);
95+
} catch (Exception e) {
96+
if (this.parent.shouldRetry(tries, e, this.deadline)) {
97+
tries++;
98+
try {
99+
Thread.sleep(this.parent.exponentialBackoff(tries, this.deadline));
100+
} catch (Exception ignored) {
101+
}
102+
continue;
103+
}
104+
throw Plumbing.convertExceptionToPorcelain(e);
105+
}
106+
break;
107+
}
108+
109+
List<GrantedAccountEntitlement> page =
110+
Plumbing.convertRepeatedGrantedAccountEntitlementToPorcelain(
111+
plumbingResponse.getGrantedAccountEntitlementsList());
112+
113+
boolean hasNextCursor = plumbingResponse.getMeta().getNextCursor() != "";
114+
builder.setMeta(
115+
ListRequestMetadata.newBuilder()
116+
.setCursor(plumbingResponse.getMeta().getNextCursor()));
117+
118+
return new PageResult<GrantedAccountEntitlement>(page, hasNextCursor);
119+
};
120+
121+
Iterator<GrantedAccountEntitlement> iterator = new PageIterator<>(pageFetcher);
122+
123+
return () -> iterator;
124+
}
125+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2020 StrongDM Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
// Code generated by protogen. DO NOT EDIT.
17+
18+
package com.strongdm.api;
19+
20+
import java.util.List;
21+
22+
/**
23+
* GrantedEntitlementKubernetesPrivileges holds Kubernetes group memberships for a granted
24+
* entitlement.
25+
*/
26+
public class GrantedEntitlementKubernetesPrivileges {
27+
private List<String> groups;
28+
/** The Kubernetes groups granted to this principal for this resource. */
29+
public List<String> getGroups() {
30+
return this.groups;
31+
}
32+
/** The Kubernetes groups granted to this principal for this resource. */
33+
public void setGroups(List<String> in) {
34+
this.groups = in;
35+
}
36+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright 2020 StrongDM Inc
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
// Code generated by protogen. DO NOT EDIT.
17+
18+
package com.strongdm.api;
19+
20+
import java.util.Date;
21+
22+
/**
23+
* GrantedResourceEntitlement represents an individual entitlement of an Account to a Resource,
24+
* viewed from the resource's perspective.
25+
*/
26+
public class GrantedResourceEntitlement {
27+
private String accountId;
28+
/** The unique identifier of the Account that has access to this resource. */
29+
public String getAccountId() {
30+
return this.accountId;
31+
}
32+
/** The unique identifier of the Account that has access to this resource. */
33+
public void setAccountId(String in) {
34+
this.accountId = in;
35+
}
36+
37+
private String groupId;
38+
/** The unique identifier of the group associated with this entitlement, if any. */
39+
public String getGroupId() {
40+
return this.groupId;
41+
}
42+
/** The unique identifier of the group associated with this entitlement, if any. */
43+
public void setGroupId(String in) {
44+
this.groupId = in;
45+
}
46+
47+
private Date lastAccessed;
48+
/**
49+
* The most recent time at which the account accessed this resource. Empty if the resource has
50+
* never been accessed.
51+
*/
52+
public Date getLastAccessed() {
53+
return this.lastAccessed;
54+
}
55+
/**
56+
* The most recent time at which the account accessed this resource. Empty if the resource has
57+
* never been accessed.
58+
*/
59+
public void setLastAccessed(Date in) {
60+
this.lastAccessed = in;
61+
}
62+
63+
private MappedIdentities mappedIdentities;
64+
/** The mapped identity privileges for this entitlement, such as Kubernetes group memberships. */
65+
public MappedIdentities getMappedIdentities() {
66+
return this.mappedIdentities;
67+
}
68+
/** The mapped identity privileges for this entitlement, such as Kubernetes group memberships. */
69+
public void setMappedIdentities(MappedIdentities in) {
70+
this.mappedIdentities = in;
71+
}
72+
73+
private String originId;
74+
/** The unique identifier of the origin of this entitlement (e.g., a Role or AccountGrant ID). */
75+
public String getOriginId() {
76+
return this.originId;
77+
}
78+
/** The unique identifier of the origin of this entitlement (e.g., a Role or AccountGrant ID). */
79+
public void setOriginId(String in) {
80+
this.originId = in;
81+
}
82+
}

0 commit comments

Comments
 (0)