Skip to content

Commit

Permalink
introduce environment metadata field for domains (#2487)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Avetisyan <[email protected]>
Co-authored-by: Henry Avetisyan <[email protected]>
  • Loading branch information
havetisyan and havetisyan authored Jan 22, 2024
1 parent e7fc7fe commit 73194d0
Show file tree
Hide file tree
Showing 28 changed files with 393 additions and 40 deletions.
66 changes: 66 additions & 0 deletions clients/go/zms/model.go

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

1 change: 1 addition & 0 deletions clients/go/zms/zms_schema.go

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

13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public class Domain {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;
public String name;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Expand Down Expand Up @@ -276,6 +279,13 @@ public Domain setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public Domain setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}
public Domain setName(String name) {
this.name = name;
return this;
Expand Down Expand Up @@ -380,6 +390,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
if (name == null ? a.name != null : !name.equals(a.name)) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/DomainData.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class DomainData {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;
public String name;
public List<Role> roles;
public SignedPolicies policies;
Expand Down Expand Up @@ -272,6 +275,13 @@ public DomainData setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public DomainData setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}
public DomainData setName(String name) {
this.name = name;
return this;
Expand Down Expand Up @@ -404,6 +414,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
if (name == null ? a.name != null : !name.equals(a.name)) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/DomainMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class DomainMeta {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;

public DomainMeta setDescription(String description) {
this.description = description;
Expand Down Expand Up @@ -265,6 +268,13 @@ public DomainMeta setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public DomainMeta setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}

@Override
public boolean equals(Object another) {
Expand Down Expand Up @@ -348,6 +358,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
}
return true;
}
Expand Down
13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/SubDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class SubDomain {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;
public String name;
public List<String> adminUsers;
@RdlOptional
Expand Down Expand Up @@ -271,6 +274,13 @@ public SubDomain setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public SubDomain setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}
public SubDomain setName(String name) {
this.name = name;
return this;
Expand Down Expand Up @@ -382,6 +392,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
if (name == null ? a.name != null : !name.equals(a.name)) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/TopLevelDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ public class TopLevelDomain {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;
public String name;
public List<String> adminUsers;
@RdlOptional
Expand Down Expand Up @@ -271,6 +274,13 @@ public TopLevelDomain setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public TopLevelDomain setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}
public TopLevelDomain setName(String name) {
this.name = name;
return this;
Expand Down Expand Up @@ -375,6 +385,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
if (name == null ? a.name != null : !name.equals(a.name)) {
return false;
}
Expand Down
13 changes: 13 additions & 0 deletions core/zms/src/main/java/com/yahoo/athenz/zms/UserDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class UserDomain {
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public Map<String, String> contacts;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public String environment;
public String name;
@RdlOptional
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Expand Down Expand Up @@ -269,6 +272,13 @@ public UserDomain setContacts(Map<String, String> contacts) {
public Map<String, String> getContacts() {
return contacts;
}
public UserDomain setEnvironment(String environment) {
this.environment = environment;
return this;
}
public String getEnvironment() {
return environment;
}
public UserDomain setName(String name) {
this.name = name;
return this;
Expand Down Expand Up @@ -366,6 +376,9 @@ public boolean equals(Object another) {
if (contacts == null ? a.contacts != null : !contacts.equals(a.contacts)) {
return false;
}
if (environment == null ? a.environment != null : !environment.equals(a.environment)) {
return false;
}
if (name == null ? a.name != null : !name.equals(a.name)) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ private static Schema build() {
.field("memberPurgeExpiryDays", "Int32", true, "purge role/group members with expiry date configured days in the past")
.field("productId", "String", true, "associated product id (system attribute - uniqueness check - if enabled)")
.field("featureFlags", "Int32", true, "features enabled per domain (system attribute)")
.mapField("contacts", "SimpleName", "String", true, "list of domain contacts (PE-Owner, Product-Owner, etc), each type can have a single value");
.mapField("contacts", "SimpleName", "String", true, "list of domain contacts (PE-Owner, Product-Owner, etc), each type can have a single value")
.field("environment", "String", true, "domain environment e.g. production, staging, etc");

sb.structType("Domain", "DomainMeta")
.comment("A domain is an independent partition of users, roles, and resources. Its name represents the definition of a namespace; the only way a new namespace can be created, from the top, is by creating Domains. Administration of a domain is governed by the parent domain (using reverse-DNS namespaces). The top level domains are governed by the special \"sys.auth\" domain.")
Expand Down
1 change: 1 addition & 0 deletions core/zms/src/main/rdl/Domain.tdl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type DomainMeta Struct {
String productId (optional); //associated product id (system attribute - uniqueness check - if enabled)
Int32 featureFlags (optional); //features enabled per domain (system attribute)
Map<SimpleName,String> contacts (optional); //list of domain contacts (PE-Owner, Product-Owner, etc), each type can have a single value
String environment (optional); //domain environment e.g. production, staging, etc
}

//A domain is an independent partition of users, roles, and resources.
Expand Down
Loading

0 comments on commit 73194d0

Please sign in to comment.