Skip to content

Commit

Permalink
Merge pull request #19 from statisticsnorway/feat/add-atlantis-folder…
Browse files Browse the repository at this point in the history
…-iam

Add folder_iam field to Atlantis config
  • Loading branch information
nicolst authored Apr 23, 2024
2 parents 2f19a91 + 5a77d72 commit 20c7bf5
Show file tree
Hide file tree
Showing 3 changed files with 284 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"name",
"repos"
"repos",
"folder_iam"
})
@Generated("jsonschema2pojo")
public class Atlantis implements Serializable
Expand All @@ -43,10 +44,18 @@ public class Atlantis implements Serializable
@JsonPropertyDescription("Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.")
@Valid
private List<String> repos = new ArrayList<String>();
/**
* Array of folder bindings to set for the Atlantis SA.
*
*/
@JsonProperty("folder_iam")
@JsonPropertyDescription("Array of folder bindings to set for the Atlantis SA.")
@Valid
private List<FolderIam__1> folderIam = new ArrayList<FolderIam__1>();
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = -5763719206269168949L;
private final static long serialVersionUID = 854245460037993476L;

/**
* No args constructor for use in serialization
Expand All @@ -59,13 +68,16 @@ public Atlantis() {
*
* @param repos
* Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.
* @param folderIam
* Array of folder bindings to set for the Atlantis SA.
* @param name
* The name of the atlantis instance.
*/
public Atlantis(String name, List<String> repos) {
public Atlantis(String name, List<String> repos, List<FolderIam__1> folderIam) {
super();
this.name = name;
this.repos = repos;
this.folderIam = folderIam;
}

public static Atlantis.AtlantisBuilderBase builder() {
Expand Down Expand Up @@ -110,6 +122,24 @@ public void setRepos(List<String> repos) {
this.repos = repos;
}

/**
* Array of folder bindings to set for the Atlantis SA.
*
*/
@JsonProperty("folder_iam")
public List<FolderIam__1> getFolderIam() {
return folderIam;
}

/**
* Array of folder bindings to set for the Atlantis SA.
*
*/
@JsonProperty("folder_iam")
public void setFolderIam(List<FolderIam__1> folderIam) {
this.folderIam = folderIam;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
Expand All @@ -132,6 +162,10 @@ public String toString() {
sb.append('=');
sb.append(((this.repos == null)?"<null>":this.repos));
sb.append(',');
sb.append("folderIam");
sb.append('=');
sb.append(((this.folderIam == null)?"<null>":this.folderIam));
sb.append(',');
sb.append("additionalProperties");
sb.append('=');
sb.append(((this.additionalProperties == null)?"<null>":this.additionalProperties));
Expand All @@ -150,6 +184,7 @@ public int hashCode() {
result = ((result* 31)+((this.name == null)? 0 :this.name.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
result = ((result* 31)+((this.repos == null)? 0 :this.repos.hashCode()));
result = ((result* 31)+((this.folderIam == null)? 0 :this.folderIam.hashCode()));
return result;
}

Expand All @@ -162,7 +197,7 @@ public boolean equals(Object other) {
return false;
}
Atlantis rhs = ((Atlantis) other);
return ((((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name)))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.repos == rhs.repos)||((this.repos!= null)&&this.repos.equals(rhs.repos))));
return (((((this.name == rhs.name)||((this.name!= null)&&this.name.equals(rhs.name)))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.repos == rhs.repos)||((this.repos!= null)&&this.repos.equals(rhs.repos))))&&((this.folderIam == rhs.folderIam)||((this.folderIam!= null)&&this.folderIam.equals(rhs.folderIam))));
}

public static class AtlantisBuilder
Expand All @@ -174,8 +209,8 @@ public AtlantisBuilder() {
super();
}

public AtlantisBuilder(String name, List<String> repos) {
super(name, repos);
public AtlantisBuilder(String name, List<String> repos, List<FolderIam__1> folderIam) {
super(name, repos, folderIam);
}

}
Expand All @@ -193,10 +228,10 @@ public AtlantisBuilderBase() {
}

@SuppressWarnings("unchecked")
public AtlantisBuilderBase(String name, List<String> repos) {
public AtlantisBuilderBase(String name, List<String> repos, List<FolderIam__1> folderIam) {
// Skip initialization when called from subclass
if (this.getClass().equals(Atlantis.AtlantisBuilder.class)) {
this.instance = ((T) new Atlantis(name, repos));
this.instance = ((T) new Atlantis(name, repos, folderIam));
}
}

Expand All @@ -217,6 +252,11 @@ public Atlantis.AtlantisBuilderBase withRepos(List<String> repos) {
return this;
}

public Atlantis.AtlantisBuilderBase withFolderIam(List<FolderIam__1> folderIam) {
((Atlantis) this.instance).folderIam = folderIam;
return this;
}

public Atlantis.AtlantisBuilderBase withAdditionalProperty(String name, Object value) {
((Atlantis) this.instance).additionalProperties.put(name, value);
return this;
Expand Down
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({
"folder",
"role"
})
@Generated("jsonschema2pojo")
public class FolderIam__1 implements Serializable
{

/**
* The folder number
*
*/
@JsonProperty("folder")
@JsonPropertyDescription("The folder number")
private String folder;
/**
* The role to grant
*
*/
@JsonProperty("role")
@JsonPropertyDescription("The role to grant")
private String role;
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = 4921122945890958437L;

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

/**
*
* @param folder
* The folder number.
* @param role
* The role to grant.
*/
public FolderIam__1(String folder, String role) {
super();
this.folder = folder;
this.role = role;
}

public static FolderIam__1 .FolderIam__1BuilderBase builder() {
return new FolderIam__1 .FolderIam__1Builder();
}

/**
* The folder number
*
*/
@JsonProperty("folder")
public String getFolder() {
return folder;
}

/**
* The folder number
*
*/
@JsonProperty("folder")
public void setFolder(String folder) {
this.folder = folder;
}

/**
* The role to grant
*
*/
@JsonProperty("role")
public String getRole() {
return role;
}

/**
* The role to grant
*
*/
@JsonProperty("role")
public void setRole(String role) {
this.role = role;
}

@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(FolderIam__1 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("folder");
sb.append('=');
sb.append(((this.folder == null)?"<null>":this.folder));
sb.append(',');
sb.append("role");
sb.append('=');
sb.append(((this.role == null)?"<null>":this.role));
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.folder == null)? 0 :this.folder.hashCode()));
result = ((result* 31)+((this.role == null)? 0 :this.role.hashCode()));
result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
return result;
}

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

public static class FolderIam__1Builder
extends FolderIam__1 .FolderIam__1BuilderBase<FolderIam__1>
{


public FolderIam__1Builder() {
super();
}

public FolderIam__1Builder(String folder, String role) {
super(folder, role);
}

}

public static abstract class FolderIam__1BuilderBase<T extends FolderIam__1 >{

protected T instance;

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

@SuppressWarnings("unchecked")
public FolderIam__1BuilderBase(String folder, String role) {
// Skip initialization when called from subclass
if (this.getClass().equals(FolderIam__1 .FolderIam__1Builder.class)) {
this.instance = ((T) new FolderIam__1(folder, role));
}
}

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

public FolderIam__1 .FolderIam__1BuilderBase withFolder(String folder) {
((FolderIam__1) this.instance).folder = folder;
return this;
}

public FolderIam__1 .FolderIam__1BuilderBase withRole(String role) {
((FolderIam__1) this.instance).role = role;
return this;
}

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

}

}
17 changes: 17 additions & 0 deletions src/v1/kuben-team-definition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@
"type": "string",
"pattern": "^[a-zA-Z-_.0-9]*$"
}
},
"folder_iam": {
"type": "array",
"description": "Array of folder bindings to set for the Atlantis SA.",
"items": {
"type": "object",
"properties": {
"folder": {
"type": "string",
"description": "The folder number"
},
"role": {
"type": "string",
"description": "The role to grant"
}
}
}
}
}
},
Expand Down

0 comments on commit 20c7bf5

Please sign in to comment.