forked from eclipse-dataplane-core/dataplane-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlPlane.java
More file actions
80 lines (62 loc) · 1.94 KB
/
ControlPlane.java
File metadata and controls
80 lines (62 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (c) 2026 Think-it GmbH
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Think-it GmbH - initial API and implementation
*
*/
package org.eclipse.dataplane.domain.controlplane;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import org.eclipse.dataplane.domain.registration.AuthorizationProfile;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class ControlPlane {
private String id;
private URI endpoint;
private final List<AuthorizationProfile> authorizations = new ArrayList<>();
public String getId() {
return id;
}
public URI getEndpoint() {
return endpoint;
}
public static ControlPlane.Builder newInstance() {
return new ControlPlane.Builder();
}
public List<AuthorizationProfile> getAuthorizations() {
return authorizations;
}
public AuthorizationProfile authorization() {
return getAuthorizations().stream().findAny().orElse(null);
}
@JsonPOJOBuilder
public static class Builder {
private final ControlPlane controlPlane = new ControlPlane();
private Builder() {
}
public ControlPlane build() {
Objects.requireNonNull(controlPlane.id);
return controlPlane;
}
public Builder id(String id) {
controlPlane.id = id;
return this;
}
public Builder endpoint(URI endpoint) {
controlPlane.endpoint = endpoint;
return this;
}
public Builder authorization(List<AuthorizationProfile> authorizations) {
controlPlane.authorizations.addAll(authorizations);
return this;
}
}
}