Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make monitor properties priority and restricted_roles nullable #1008

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-10-18 10:35:00.694439",
"spec_repo_commit": "303d2e3"
"regenerated": "2021-10-18 13:05:32.173095",
"spec_repo_commit": "3b56e2f"
},
"v2": {
"apigentools_version": "1.5.1.dev2",
"regenerated": "2021-10-18 10:36:09.692595",
"spec_repo_commit": "303d2e3"
"regenerated": "2021-10-18 13:06:21.888029",
"spec_repo_commit": "3b56e2f"
}
}
}
46 changes: 35 additions & 11 deletions src/main/java/com/datadog/api/v1/client/model/Monitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public class Monitor {
private MonitorOverallStates overallState;

public static final String JSON_PROPERTY_PRIORITY = "priority";
private Long priority;
private JsonNullable<Long> priority = JsonNullable.<Long>undefined();

public static final String JSON_PROPERTY_QUERY = "query";
private String query;

public static final String JSON_PROPERTY_RESTRICTED_ROLES = "restricted_roles";
private List<String> restrictedRoles = null;
private JsonNullable<List<String>> restrictedRoles = JsonNullable.<List<String>>undefined();

public static final String JSON_PROPERTY_STATE = "state";
private MonitorState state;
Expand Down Expand Up @@ -301,7 +301,7 @@ public void setOverallState(MonitorOverallStates overallState) {
}

public Monitor priority(Long priority) {
this.priority = priority;
this.priority = JsonNullable.<Long>of(priority);
return this;
}

Expand All @@ -312,16 +312,26 @@ public Monitor priority(Long priority) {
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "Integer from 1 (high) to 5 (low) indicating alert severity.")
@JsonIgnore
public Long getPriority() {
return priority.orElse(null);
}

@JsonProperty(JSON_PROPERTY_PRIORITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Long getPriority() {
public JsonNullable<Long> getPriority_JsonNullable() {
return priority;
}

public void setPriority(Long priority) {
@JsonProperty(JSON_PROPERTY_PRIORITY)
public void setPriority_JsonNullable(JsonNullable<Long> priority) {
this.priority = priority;
}

public void setPriority(Long priority) {
this.priority = JsonNullable.<Long>of(priority);
}

public Monitor query(String query) {
this.query = query;
return this;
Expand All @@ -347,15 +357,19 @@ public void setQuery(String query) {
}

public Monitor restrictedRoles(List<String> restrictedRoles) {
this.restrictedRoles = restrictedRoles;
this.restrictedRoles = JsonNullable.<List<String>>of(restrictedRoles);
return this;
}

public Monitor addRestrictedRolesItem(String restrictedRolesItem) {
if (this.restrictedRoles == null) {
this.restrictedRoles = new ArrayList<>();
if (this.restrictedRoles == null || !this.restrictedRoles.isPresent()) {
this.restrictedRoles = JsonNullable.<List<String>>of(new ArrayList<>());
}
try {
this.restrictedRoles.get().add(restrictedRolesItem);
} catch (java.util.NoSuchElementException e) {
// this can never happen, as we make sure above that the value is present
}
this.restrictedRoles.add(restrictedRolesItem);
return this;
}

Expand All @@ -370,16 +384,26 @@ public Monitor addRestrictedRolesItem(String restrictedRolesItem) {
value =
"A list of role identifiers that can be pulled from the Roles API. Cannot be used with"
+ " `locked` option.")
@JsonIgnore
public List<String> getRestrictedRoles() {
return restrictedRoles.orElse(null);
}

@JsonProperty(JSON_PROPERTY_RESTRICTED_ROLES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getRestrictedRoles() {
public JsonNullable<List<String>> getRestrictedRoles_JsonNullable() {
return restrictedRoles;
}

public void setRestrictedRoles(List<String> restrictedRoles) {
@JsonProperty(JSON_PROPERTY_RESTRICTED_ROLES)
public void setRestrictedRoles_JsonNullable(JsonNullable<List<String>> restrictedRoles) {
this.restrictedRoles = restrictedRoles;
}

public void setRestrictedRoles(List<String> restrictedRoles) {
this.restrictedRoles = JsonNullable.<List<String>>of(restrictedRoles);
}

public Monitor state(MonitorState state) {
this.state = state;
this.unparsed |= state.unparsed;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/datadog/api/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17285,6 +17285,7 @@ components:
format: int64
maximum: 5
minimum: 1
nullable: true
type: integer
query:
description: The monitor query.
Expand All @@ -17296,6 +17297,7 @@ components:
items:
description: A role UUID.
type: string
nullable: true
type: array
state:
$ref: '#/components/schemas/MonitorState'
Expand Down