Skip to content

Commit

Permalink
[GENERATE] Java classes from JSON Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
dapla-bot[bot] committed Feb 23, 2024
1 parent 04daaa8 commit d67a95c
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@

package no.ssb.dapla.kuben.v1;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.processing.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import jakarta.validation.Valid;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"enabled",
"enforce_admins"
})
@Generated("jsonschema2pojo")
public class BranchProtection implements Serializable
{

/**
* Enable the default Kuben set of branch protection rules
*
*/
@JsonProperty("enabled")
@JsonPropertyDescription("Enable the default Kuben set of branch protection rules")
private Boolean enabled;
/**
* Do not allow repository admins to bypass branch protection rules (false required for Flux2 image update automation)
*
*/
@JsonProperty("enforce_admins")
@JsonPropertyDescription("Do not allow repository admins to bypass branch protection rules (false required for Flux2 image update automation)")
private Boolean enforceAdmins;
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = -571938769444607797L;

/**
* No args constructor for use in serialization
*
*/
public BranchProtection() {
}

/**
*
* @param enforceAdmins
* Do not allow repository admins to bypass branch protection rules (false required for Flux2 image update automation).
* @param enabled
* Enable the default Kuben set of branch protection rules.
*/
public BranchProtection(Boolean enabled, Boolean enforceAdmins) {
super();
this.enabled = enabled;
this.enforceAdmins = enforceAdmins;
}

public static BranchProtection.BranchProtectionBuilderBase builder() {
return new BranchProtection.BranchProtectionBuilder();
}

/**
* Enable the default Kuben set of branch protection rules
*
*/
@JsonProperty("enabled")
public Boolean getEnabled() {
return enabled;
}

/**
* Enable the default Kuben set of branch protection rules
*
*/
@JsonProperty("enabled")
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}

/**
* Do not allow repository admins to bypass branch protection rules (false required for Flux2 image update automation)
*
*/
@JsonProperty("enforce_admins")
public Boolean getEnforceAdmins() {
return enforceAdmins;
}

/**
* Do not allow repository admins to bypass branch protection rules (false required for Flux2 image update automation)
*
*/
@JsonProperty("enforce_admins")
public void setEnforceAdmins(Boolean enforceAdmins) {
this.enforceAdmins = enforceAdmins;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(BranchProtection.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("enabled");
sb.append('=');
sb.append(((this.enabled == null)?"<null>":this.enabled));
sb.append(',');
sb.append("enforceAdmins");
sb.append('=');
sb.append(((this.enforceAdmins == null)?"<null>":this.enforceAdmins));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"<null>":this.additionalProperties));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}

@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
result = ((result* 31)+((this.enabled == null)? 0 :this.enabled.hashCode()));
result = ((result* 31)+((this.enforceAdmins == null)? 0 :this.enforceAdmins.hashCode()));
return result;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof BranchProtection) == false) {
return false;
}
BranchProtection rhs = ((BranchProtection) other);
return ((((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))&&((this.enabled == rhs.enabled)||((this.enabled!= null)&&this.enabled.equals(rhs.enabled))))&&((this.enforceAdmins == rhs.enforceAdmins)||((this.enforceAdmins!= null)&&this.enforceAdmins.equals(rhs.enforceAdmins))));
}

public static class BranchProtectionBuilder
extends BranchProtection.BranchProtectionBuilderBase<BranchProtection>
{


public BranchProtectionBuilder() {
super();
}

public BranchProtectionBuilder(Boolean enabled, Boolean enforceAdmins) {
super(enabled, enforceAdmins);
}

}

public static abstract class BranchProtectionBuilderBase<T extends BranchProtection >{

protected T instance;

@SuppressWarnings("unchecked")
public BranchProtectionBuilderBase() {
// Skip initialization when called from subclass
if (this.getClass().equals(BranchProtection.BranchProtectionBuilder.class)) {
this.instance = ((T) new BranchProtection());
}
}

@SuppressWarnings("unchecked")
public BranchProtectionBuilderBase(Boolean enabled, Boolean enforceAdmins) {
// Skip initialization when called from subclass
if (this.getClass().equals(BranchProtection.BranchProtectionBuilder.class)) {
this.instance = ((T) new BranchProtection(enabled, enforceAdmins));
}
}

public T build() {
T result;
result = this.instance;
this.instance = null;
return result;
}

public BranchProtection.BranchProtectionBuilderBase withEnabled(Boolean enabled) {
((BranchProtection) this.instance).enabled = enabled;
return this;
}

public BranchProtection.BranchProtectionBuilderBase withEnforceAdmins(Boolean enforceAdmins) {
((BranchProtection) this.instance).enforceAdmins = enforceAdmins;
return this;
}

public BranchProtection.BranchProtectionBuilderBase withAdditionalProperty(String name, Object value) {
((BranchProtection) this.instance).additionalProperties.put(name, value);
return this;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"name",
"access"
"access",
"branch_protection"
})
@Generated("jsonschema2pojo")
public class IacRepo implements Serializable
Expand All @@ -38,10 +39,13 @@ public class IacRepo implements Serializable
@JsonPropertyDescription("Map of AD group to github role")
@Valid
private Access access;
@JsonProperty("branch_protection")
@Valid
private BranchProtection branchProtection;
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = -455679121666188717L;
private final static long serialVersionUID = -4254896702421967978L;

/**
* No args constructor for use in serialization
Expand All @@ -57,10 +61,11 @@ public IacRepo() {
* @param name
* The name of the iac repo for this team.
*/
public IacRepo(String name, Access access) {
public IacRepo(String name, Access access, BranchProtection branchProtection) {
super();
this.name = name;
this.access = access;
this.branchProtection = branchProtection;
}

public static IacRepo.IacRepoBuilderBase builder() {
Expand Down Expand Up @@ -103,6 +108,16 @@ public void setAccess(Access access) {
this.access = access;
}

@JsonProperty("branch_protection")
public BranchProtection getBranchProtection() {
return branchProtection;
}

@JsonProperty("branch_protection")
public void setBranchProtection(BranchProtection branchProtection) {
this.branchProtection = branchProtection;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
Expand All @@ -125,6 +140,10 @@ public String toString() {
sb.append('=');
sb.append(((this.access == null)?"<null>":this.access));
sb.append(',');
sb.append("branchProtection");
sb.append('=');
sb.append(((this.branchProtection == null)?"<null>":this.branchProtection));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"<null>":this.additionalProperties));
Expand All @@ -141,6 +160,7 @@ public String toString() {
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.name == null)? 0 :this.name.hashCode()));
result = ((result* 31)+((this.branchProtection == null)? 0 :this.branchProtection.hashCode()));
result = ((result* 31)+((this.access == null)? 0 :this.access.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
return result;
Expand All @@ -155,7 +175,7 @@ public boolean equals(Object other) {
return false;
}
IacRepo rhs = ((IacRepo) other);
return ((((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name)))&&((this.access == rhs.access)||((this.access!= null)&&this.access.equals(rhs.access))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))));
return (((((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name)))&&((this.branchProtection == rhs.branchProtection)||((this.branchProtection!= null)&&this.branchProtection.equals(rhs.branchProtection))))&&((this.access == rhs.access)||((this.access!= null)&&this.access.equals(rhs.access))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))));
}

public static class IacRepoBuilder
Expand All @@ -167,8 +187,8 @@ public IacRepoBuilder() {
super();
}

public IacRepoBuilder(String name, Access access) {
super(name, access);
public IacRepoBuilder(String name, Access access, BranchProtection branchProtection) {
super(name, access, branchProtection);
}

}
Expand All @@ -186,10 +206,10 @@ public IacRepoBuilderBase() {
}

@SuppressWarnings("unchecked")
public IacRepoBuilderBase(String name, Access access) {
public IacRepoBuilderBase(String name, Access access, BranchProtection branchProtection) {
// Skip initialization when called from subclass
if (this.getClass().equals(IacRepo.IacRepoBuilder.class)) {
this.instance = ((T) new IacRepo(name, access));
this.instance = ((T) new IacRepo(name, access, branchProtection));
}
}

Expand All @@ -210,6 +230,11 @@ public IacRepo.IacRepoBuilderBase withAccess(Access access) {
return this;
}

public IacRepo.IacRepoBuilderBase withBranchProtection(BranchProtection branchProtection) {
((IacRepo) this.instance).branchProtection = branchProtection;
return this;
}

public IacRepo.IacRepoBuilderBase withAdditionalProperty(String name, Object value) {
((IacRepo) this.instance).additionalProperties.put(name, value);
return this;
Expand Down

0 comments on commit d67a95c

Please sign in to comment.