![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.fluent.models.WebhookCreateOrUpdateProperties Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automation.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.automation.models.RunbookAssociationProperty;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
/**
* The properties of the create webhook operation.
*/
@Fluent
public final class WebhookCreateOrUpdateProperties implements JsonSerializable {
/*
* Gets or sets the value of the enabled flag of webhook.
*/
private Boolean isEnabled;
/*
* Gets or sets the uri.
*/
private String uri;
/*
* Gets or sets the expiry time.
*/
private OffsetDateTime expiryTime;
/*
* Gets or sets the parameters of the job.
*/
private Map parameters;
/*
* Gets or sets the runbook.
*/
private RunbookAssociationProperty runbook;
/*
* Gets or sets the name of the hybrid worker group the webhook job will run on.
*/
private String runOn;
/**
* Creates an instance of WebhookCreateOrUpdateProperties class.
*/
public WebhookCreateOrUpdateProperties() {
}
/**
* Get the isEnabled property: Gets or sets the value of the enabled flag of webhook.
*
* @return the isEnabled value.
*/
public Boolean isEnabled() {
return this.isEnabled;
}
/**
* Set the isEnabled property: Gets or sets the value of the enabled flag of webhook.
*
* @param isEnabled the isEnabled value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* Get the uri property: Gets or sets the uri.
*
* @return the uri value.
*/
public String uri() {
return this.uri;
}
/**
* Set the uri property: Gets or sets the uri.
*
* @param uri the uri value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withUri(String uri) {
this.uri = uri;
return this;
}
/**
* Get the expiryTime property: Gets or sets the expiry time.
*
* @return the expiryTime value.
*/
public OffsetDateTime expiryTime() {
return this.expiryTime;
}
/**
* Set the expiryTime property: Gets or sets the expiry time.
*
* @param expiryTime the expiryTime value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withExpiryTime(OffsetDateTime expiryTime) {
this.expiryTime = expiryTime;
return this;
}
/**
* Get the parameters property: Gets or sets the parameters of the job.
*
* @return the parameters value.
*/
public Map parameters() {
return this.parameters;
}
/**
* Set the parameters property: Gets or sets the parameters of the job.
*
* @param parameters the parameters value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withParameters(Map parameters) {
this.parameters = parameters;
return this;
}
/**
* Get the runbook property: Gets or sets the runbook.
*
* @return the runbook value.
*/
public RunbookAssociationProperty runbook() {
return this.runbook;
}
/**
* Set the runbook property: Gets or sets the runbook.
*
* @param runbook the runbook value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withRunbook(RunbookAssociationProperty runbook) {
this.runbook = runbook;
return this;
}
/**
* Get the runOn property: Gets or sets the name of the hybrid worker group the webhook job will run on.
*
* @return the runOn value.
*/
public String runOn() {
return this.runOn;
}
/**
* Set the runOn property: Gets or sets the name of the hybrid worker group the webhook job will run on.
*
* @param runOn the runOn value to set.
* @return the WebhookCreateOrUpdateProperties object itself.
*/
public WebhookCreateOrUpdateProperties withRunOn(String runOn) {
this.runOn = runOn;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (runbook() != null) {
runbook().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
jsonWriter.writeStringField("uri", this.uri);
jsonWriter.writeStringField("expiryTime",
this.expiryTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expiryTime));
jsonWriter.writeMapField("parameters", this.parameters, (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("runbook", this.runbook);
jsonWriter.writeStringField("runOn", this.runOn);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WebhookCreateOrUpdateProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WebhookCreateOrUpdateProperties if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IOException If an error occurs while reading the WebhookCreateOrUpdateProperties.
*/
public static WebhookCreateOrUpdateProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WebhookCreateOrUpdateProperties deserializedWebhookCreateOrUpdateProperties
= new WebhookCreateOrUpdateProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("isEnabled".equals(fieldName)) {
deserializedWebhookCreateOrUpdateProperties.isEnabled = reader.getNullable(JsonReader::getBoolean);
} else if ("uri".equals(fieldName)) {
deserializedWebhookCreateOrUpdateProperties.uri = reader.getString();
} else if ("expiryTime".equals(fieldName)) {
deserializedWebhookCreateOrUpdateProperties.expiryTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("parameters".equals(fieldName)) {
Map parameters = reader.readMap(reader1 -> reader1.getString());
deserializedWebhookCreateOrUpdateProperties.parameters = parameters;
} else if ("runbook".equals(fieldName)) {
deserializedWebhookCreateOrUpdateProperties.runbook = RunbookAssociationProperty.fromJson(reader);
} else if ("runOn".equals(fieldName)) {
deserializedWebhookCreateOrUpdateProperties.runOn = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedWebhookCreateOrUpdateProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy