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

com.azure.messaging.eventgrid.systemevents.ContainerRegistryEventData Maven / Gradle / Ivy

There is a newer version: 4.27.0
Show 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.messaging.eventgrid.systemevents;

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;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * The content of the event request message.
 */
@Fluent
public class ContainerRegistryEventData implements JsonSerializable {
    /*
     * The event ID.
     */
    private String id;

    /*
     * The time at which the event occurred.
     */
    private OffsetDateTime timestamp;

    /*
     * The action that encompasses the provided event.
     */
    private String action;

    /*
     * The location of the event.
     */
    private String location;

    /*
     * The target of the event.
     */
    private ContainerRegistryEventTarget target;

    /*
     * The request that generated the event.
     */
    private ContainerRegistryEventRequest request;

    /*
     * The agent that initiated the event. For most situations, this could be from the authorization context of the
     * request.
     */
    private ContainerRegistryEventActor actor;

    /*
     * The registry node that generated the event. Put differently, while the actor initiates the event, the source
     * generates it.
     */
    private ContainerRegistryEventSource source;

    /*
     * The connected registry information if the event is generated by a connected registry.
     */
    private ContainerRegistryEventConnectedRegistry connectedRegistry;

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

    /**
     * Get the id property: The event ID.
     * 
     * @return the id value.
     */
    public String getId() {
        return this.id;
    }

    /**
     * Set the id property: The event ID.
     * 
     * @param id the id value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the timestamp property: The time at which the event occurred.
     * 
     * @return the timestamp value.
     */
    public OffsetDateTime getTimestamp() {
        return this.timestamp;
    }

    /**
     * Set the timestamp property: The time at which the event occurred.
     * 
     * @param timestamp the timestamp value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setTimestamp(OffsetDateTime timestamp) {
        this.timestamp = timestamp;
        return this;
    }

    /**
     * Get the action property: The action that encompasses the provided event.
     * 
     * @return the action value.
     */
    public String getAction() {
        return this.action;
    }

    /**
     * Set the action property: The action that encompasses the provided event.
     * 
     * @param action the action value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setAction(String action) {
        this.action = action;
        return this;
    }

    /**
     * Get the location property: The location of the event.
     * 
     * @return the location value.
     */
    public String getLocation() {
        return this.location;
    }

    /**
     * Set the location property: The location of the event.
     * 
     * @param location the location value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the target property: The target of the event.
     * 
     * @return the target value.
     */
    public ContainerRegistryEventTarget getTarget() {
        return this.target;
    }

    /**
     * Set the target property: The target of the event.
     * 
     * @param target the target value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setTarget(ContainerRegistryEventTarget target) {
        this.target = target;
        return this;
    }

    /**
     * Get the request property: The request that generated the event.
     * 
     * @return the request value.
     */
    public ContainerRegistryEventRequest getRequest() {
        return this.request;
    }

    /**
     * Set the request property: The request that generated the event.
     * 
     * @param request the request value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setRequest(ContainerRegistryEventRequest request) {
        this.request = request;
        return this;
    }

    /**
     * Get the actor property: The agent that initiated the event. For most situations, this could be from the
     * authorization context of the request.
     * 
     * @return the actor value.
     */
    public ContainerRegistryEventActor getActor() {
        return this.actor;
    }

    /**
     * Set the actor property: The agent that initiated the event. For most situations, this could be from the
     * authorization context of the request.
     * 
     * @param actor the actor value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setActor(ContainerRegistryEventActor actor) {
        this.actor = actor;
        return this;
    }

    /**
     * Get the source property: The registry node that generated the event. Put differently, while the actor initiates
     * the event, the source generates it.
     * 
     * @return the source value.
     */
    public ContainerRegistryEventSource getSource() {
        return this.source;
    }

    /**
     * Set the source property: The registry node that generated the event. Put differently, while the actor initiates
     * the event, the source generates it.
     * 
     * @param source the source value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setSource(ContainerRegistryEventSource source) {
        this.source = source;
        return this;
    }

    /**
     * Get the connectedRegistry property: The connected registry information if the event is generated by a connected
     * registry.
     * 
     * @return the connectedRegistry value.
     */
    public ContainerRegistryEventConnectedRegistry getConnectedRegistry() {
        return this.connectedRegistry;
    }

    /**
     * Set the connectedRegistry property: The connected registry information if the event is generated by a connected
     * registry.
     * 
     * @param connectedRegistry the connectedRegistry value to set.
     * @return the ContainerRegistryEventData object itself.
     */
    public ContainerRegistryEventData setConnectedRegistry(ContainerRegistryEventConnectedRegistry connectedRegistry) {
        this.connectedRegistry = connectedRegistry;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("id", this.id);
        jsonWriter.writeStringField("timestamp",
            this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp));
        jsonWriter.writeStringField("action", this.action);
        jsonWriter.writeStringField("location", this.location);
        jsonWriter.writeJsonField("target", this.target);
        jsonWriter.writeJsonField("request", this.request);
        jsonWriter.writeJsonField("actor", this.actor);
        jsonWriter.writeJsonField("source", this.source);
        jsonWriter.writeJsonField("connectedRegistry", this.connectedRegistry);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedContainerRegistryEventData.id = reader.getString();
                } else if ("timestamp".equals(fieldName)) {
                    deserializedContainerRegistryEventData.timestamp
                        = reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString()));
                } else if ("action".equals(fieldName)) {
                    deserializedContainerRegistryEventData.action = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedContainerRegistryEventData.location = reader.getString();
                } else if ("target".equals(fieldName)) {
                    deserializedContainerRegistryEventData.target = ContainerRegistryEventTarget.fromJson(reader);
                } else if ("request".equals(fieldName)) {
                    deserializedContainerRegistryEventData.request = ContainerRegistryEventRequest.fromJson(reader);
                } else if ("actor".equals(fieldName)) {
                    deserializedContainerRegistryEventData.actor = ContainerRegistryEventActor.fromJson(reader);
                } else if ("source".equals(fieldName)) {
                    deserializedContainerRegistryEventData.source = ContainerRegistryEventSource.fromJson(reader);
                } else if ("connectedRegistry".equals(fieldName)) {
                    deserializedContainerRegistryEventData.connectedRegistry
                        = ContainerRegistryEventConnectedRegistry.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedContainerRegistryEventData;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy