com.azure.resourcemanager.automation.fluent.models.WebhookInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
The newest version!
// 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.management.ProxyResource;
import com.azure.json.JsonReader;
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.util.Map;
/**
* Definition of the webhook type.
*/
@Fluent
public final class WebhookInner extends ProxyResource {
/*
* Gets or sets the webhook properties.
*/
private WebhookProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of WebhookInner class.
*/
public WebhookInner() {
}
/**
* Get the innerProperties property: Gets or sets the webhook properties.
*
* @return the innerProperties value.
*/
private WebhookProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the isEnabled property: Gets or sets the value of the enabled flag of the webhook.
*
* @return the isEnabled value.
*/
public Boolean isEnabled() {
return this.innerProperties() == null ? null : this.innerProperties().isEnabled();
}
/**
* Set the isEnabled property: Gets or sets the value of the enabled flag of the webhook.
*
* @param isEnabled the isEnabled value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withIsEnabled(Boolean isEnabled) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withIsEnabled(isEnabled);
return this;
}
/**
* Get the uri property: Gets or sets the webhook uri.
*
* @return the uri value.
*/
public String uri() {
return this.innerProperties() == null ? null : this.innerProperties().uri();
}
/**
* Set the uri property: Gets or sets the webhook uri.
*
* @param uri the uri value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withUri(String uri) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withUri(uri);
return this;
}
/**
* Get the expiryTime property: Gets or sets the expiry time.
*
* @return the expiryTime value.
*/
public OffsetDateTime expiryTime() {
return this.innerProperties() == null ? null : this.innerProperties().expiryTime();
}
/**
* Set the expiryTime property: Gets or sets the expiry time.
*
* @param expiryTime the expiryTime value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withExpiryTime(OffsetDateTime expiryTime) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withExpiryTime(expiryTime);
return this;
}
/**
* Get the lastInvokedTime property: Gets or sets the last invoked time.
*
* @return the lastInvokedTime value.
*/
public OffsetDateTime lastInvokedTime() {
return this.innerProperties() == null ? null : this.innerProperties().lastInvokedTime();
}
/**
* Set the lastInvokedTime property: Gets or sets the last invoked time.
*
* @param lastInvokedTime the lastInvokedTime value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withLastInvokedTime(OffsetDateTime lastInvokedTime) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withLastInvokedTime(lastInvokedTime);
return this;
}
/**
* Get the parameters property: Gets or sets the parameters of the job that is created when the webhook calls the
* runbook it is associated with.
*
* @return the parameters value.
*/
public Map parameters() {
return this.innerProperties() == null ? null : this.innerProperties().parameters();
}
/**
* Set the parameters property: Gets or sets the parameters of the job that is created when the webhook calls the
* runbook it is associated with.
*
* @param parameters the parameters value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withParameters(Map parameters) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withParameters(parameters);
return this;
}
/**
* Get the runbook property: Gets or sets the runbook the webhook is associated with.
*
* @return the runbook value.
*/
public RunbookAssociationProperty runbook() {
return this.innerProperties() == null ? null : this.innerProperties().runbook();
}
/**
* Set the runbook property: Gets or sets the runbook the webhook is associated with.
*
* @param runbook the runbook value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withRunbook(RunbookAssociationProperty runbook) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withRunbook(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.innerProperties() == null ? null : this.innerProperties().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 WebhookInner object itself.
*/
public WebhookInner withRunOn(String runOn) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withRunOn(runOn);
return this;
}
/**
* Get the creationTime property: Gets or sets the creation time.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.innerProperties() == null ? null : this.innerProperties().creationTime();
}
/**
* Set the creationTime property: Gets or sets the creation time.
*
* @param creationTime the creationTime value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withCreationTime(OffsetDateTime creationTime) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withCreationTime(creationTime);
return this;
}
/**
* Get the lastModifiedTime property: Gets or sets the last modified time.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime();
}
/**
* Set the lastModifiedTime property: Gets or sets the last modified time.
*
* @param lastModifiedTime the lastModifiedTime value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withLastModifiedTime(OffsetDateTime lastModifiedTime) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withLastModifiedTime(lastModifiedTime);
return this;
}
/**
* Get the lastModifiedBy property: Details of the user who last modified the Webhook.
*
* @return the lastModifiedBy value.
*/
public String lastModifiedBy() {
return this.innerProperties() == null ? null : this.innerProperties().lastModifiedBy();
}
/**
* Set the lastModifiedBy property: Details of the user who last modified the Webhook.
*
* @param lastModifiedBy the lastModifiedBy value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withLastModifiedBy(String lastModifiedBy) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withLastModifiedBy(lastModifiedBy);
return this;
}
/**
* Get the description property: Gets or sets the description.
*
* @return the description value.
*/
public String description() {
return this.innerProperties() == null ? null : this.innerProperties().description();
}
/**
* Set the description property: Gets or sets the description.
*
* @param description the description value to set.
* @return the WebhookInner object itself.
*/
public WebhookInner withDescription(String description) {
if (this.innerProperties() == null) {
this.innerProperties = new WebhookProperties();
}
this.innerProperties().withDescription(description);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WebhookInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WebhookInner if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the WebhookInner.
*/
public static WebhookInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WebhookInner deserializedWebhookInner = new WebhookInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedWebhookInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedWebhookInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedWebhookInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedWebhookInner.innerProperties = WebhookProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedWebhookInner;
});
}
}