All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.securityinsights.models.Webhook Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.

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.securityinsights.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Detail about the webhook object.
 */
@Fluent
public final class Webhook implements JsonSerializable {
    /*
     * Unique identifier for the webhook.
     */
    private String webhookId;

    /*
     * URL that gets invoked by the webhook.
     */
    private String webhookUrl;

    /*
     * Time when the webhook secret was updated.
     */
    private String webhookSecretUpdateTime;

    /*
     * A flag to instruct the backend service to rotate webhook secret.
     */
    private Boolean rotateWebhookSecret;

    /**
     * Creates an instance of Webhook class.
     */
    public Webhook() {
    }

    /**
     * Get the webhookId property: Unique identifier for the webhook.
     * 
     * @return the webhookId value.
     */
    public String webhookId() {
        return this.webhookId;
    }

    /**
     * Set the webhookId property: Unique identifier for the webhook.
     * 
     * @param webhookId the webhookId value to set.
     * @return the Webhook object itself.
     */
    public Webhook withWebhookId(String webhookId) {
        this.webhookId = webhookId;
        return this;
    }

    /**
     * Get the webhookUrl property: URL that gets invoked by the webhook.
     * 
     * @return the webhookUrl value.
     */
    public String webhookUrl() {
        return this.webhookUrl;
    }

    /**
     * Set the webhookUrl property: URL that gets invoked by the webhook.
     * 
     * @param webhookUrl the webhookUrl value to set.
     * @return the Webhook object itself.
     */
    public Webhook withWebhookUrl(String webhookUrl) {
        this.webhookUrl = webhookUrl;
        return this;
    }

    /**
     * Get the webhookSecretUpdateTime property: Time when the webhook secret was updated.
     * 
     * @return the webhookSecretUpdateTime value.
     */
    public String webhookSecretUpdateTime() {
        return this.webhookSecretUpdateTime;
    }

    /**
     * Set the webhookSecretUpdateTime property: Time when the webhook secret was updated.
     * 
     * @param webhookSecretUpdateTime the webhookSecretUpdateTime value to set.
     * @return the Webhook object itself.
     */
    public Webhook withWebhookSecretUpdateTime(String webhookSecretUpdateTime) {
        this.webhookSecretUpdateTime = webhookSecretUpdateTime;
        return this;
    }

    /**
     * Get the rotateWebhookSecret property: A flag to instruct the backend service to rotate webhook secret.
     * 
     * @return the rotateWebhookSecret value.
     */
    public Boolean rotateWebhookSecret() {
        return this.rotateWebhookSecret;
    }

    /**
     * Set the rotateWebhookSecret property: A flag to instruct the backend service to rotate webhook secret.
     * 
     * @param rotateWebhookSecret the rotateWebhookSecret value to set.
     * @return the Webhook object itself.
     */
    public Webhook withRotateWebhookSecret(Boolean rotateWebhookSecret) {
        this.rotateWebhookSecret = rotateWebhookSecret;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("webhookId", this.webhookId);
        jsonWriter.writeStringField("webhookUrl", this.webhookUrl);
        jsonWriter.writeStringField("webhookSecretUpdateTime", this.webhookSecretUpdateTime);
        jsonWriter.writeBooleanField("rotateWebhookSecret", this.rotateWebhookSecret);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of Webhook from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of Webhook 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 Webhook.
     */
    public static Webhook fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            Webhook deserializedWebhook = new Webhook();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("webhookId".equals(fieldName)) {
                    deserializedWebhook.webhookId = reader.getString();
                } else if ("webhookUrl".equals(fieldName)) {
                    deserializedWebhook.webhookUrl = reader.getString();
                } else if ("webhookSecretUpdateTime".equals(fieldName)) {
                    deserializedWebhook.webhookSecretUpdateTime = reader.getString();
                } else if ("rotateWebhookSecret".equals(fieldName)) {
                    deserializedWebhook.rotateWebhookSecret = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWebhook;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy