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

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

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

/**
 * The thumbprint is a unique value for the x509 certificate, commonly used to find a particular certificate in a
 * certificate store. The thumbprint is dynamically generated using the SHA1 algorithm, and does not physically exist in
 * the certificate.
 */
@Fluent
public final class DeviceTwinInfoX509Thumbprint implements JsonSerializable {
    /*
     * Primary thumbprint for the x509 certificate.
     */
    private String primaryThumbprint;

    /*
     * Secondary thumbprint for the x509 certificate.
     */
    private String secondaryThumbprint;

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

    /**
     * Get the primaryThumbprint property: Primary thumbprint for the x509 certificate.
     * 
     * @return the primaryThumbprint value.
     */
    public String getPrimaryThumbprint() {
        return this.primaryThumbprint;
    }

    /**
     * Set the primaryThumbprint property: Primary thumbprint for the x509 certificate.
     * 
     * @param primaryThumbprint the primaryThumbprint value to set.
     * @return the DeviceTwinInfoX509Thumbprint object itself.
     */
    public DeviceTwinInfoX509Thumbprint setPrimaryThumbprint(String primaryThumbprint) {
        this.primaryThumbprint = primaryThumbprint;
        return this;
    }

    /**
     * Get the secondaryThumbprint property: Secondary thumbprint for the x509 certificate.
     * 
     * @return the secondaryThumbprint value.
     */
    public String getSecondaryThumbprint() {
        return this.secondaryThumbprint;
    }

    /**
     * Set the secondaryThumbprint property: Secondary thumbprint for the x509 certificate.
     * 
     * @param secondaryThumbprint the secondaryThumbprint value to set.
     * @return the DeviceTwinInfoX509Thumbprint object itself.
     */
    public DeviceTwinInfoX509Thumbprint setSecondaryThumbprint(String secondaryThumbprint) {
        this.secondaryThumbprint = secondaryThumbprint;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("primaryThumbprint", this.primaryThumbprint);
        jsonWriter.writeStringField("secondaryThumbprint", this.secondaryThumbprint);
        return jsonWriter.writeEndObject();
    }

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

                if ("primaryThumbprint".equals(fieldName)) {
                    deserializedDeviceTwinInfoX509Thumbprint.primaryThumbprint = reader.getString();
                } else if ("secondaryThumbprint".equals(fieldName)) {
                    deserializedDeviceTwinInfoX509Thumbprint.secondaryThumbprint = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDeviceTwinInfoX509Thumbprint;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy