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

com.azure.security.keyvault.certificates.implementation.models.CertificateUpdateParameters Maven / Gradle / Ivy

There is a newer version: 4.6.7
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.security.keyvault.certificates.implementation.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;
import java.util.Map;

/** The certificate update parameters. */
@Fluent
public final class CertificateUpdateParameters implements JsonSerializable {
    /*
     * The management policy for the certificate.
     */
    private CertificatePolicy certificatePolicy;

    /*
     * The attributes of the certificate (optional).
     */
    private CertificateAttributes certificateAttributes;

    /*
     * Application specific metadata in the form of key-value pairs.
     */
    private Map tags;

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

    /**
     * Get the certificatePolicy property: The management policy for the certificate.
     *
     * @return the certificatePolicy value.
     */
    public CertificatePolicy getCertificatePolicy() {
        return this.certificatePolicy;
    }

    /**
     * Set the certificatePolicy property: The management policy for the certificate.
     *
     * @param certificatePolicy the certificatePolicy value to set.
     * @return the CertificateUpdateParameters object itself.
     */
    public CertificateUpdateParameters setCertificatePolicy(CertificatePolicy certificatePolicy) {
        this.certificatePolicy = certificatePolicy;
        return this;
    }

    /**
     * Get the certificateAttributes property: The attributes of the certificate (optional).
     *
     * @return the certificateAttributes value.
     */
    public CertificateAttributes getCertificateAttributes() {
        return this.certificateAttributes;
    }

    /**
     * Set the certificateAttributes property: The attributes of the certificate (optional).
     *
     * @param certificateAttributes the certificateAttributes value to set.
     * @return the CertificateUpdateParameters object itself.
     */
    public CertificateUpdateParameters setCertificateAttributes(CertificateAttributes certificateAttributes) {
        this.certificateAttributes = certificateAttributes;
        return this;
    }

    /**
     * Get the tags property: Application specific metadata in the form of key-value pairs.
     *
     * @return the tags value.
     */
    public Map getTags() {
        return this.tags;
    }

    /**
     * Set the tags property: Application specific metadata in the form of key-value pairs.
     *
     * @param tags the tags value to set.
     * @return the CertificateUpdateParameters object itself.
     */
    public CertificateUpdateParameters setTags(Map tags) {
        this.tags = tags;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("policy", this.certificatePolicy);
        jsonWriter.writeJsonField("attributes", this.certificateAttributes);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                        if ("policy".equals(fieldName)) {
                            deserializedCertificateUpdateParameters.certificatePolicy =
                                    CertificatePolicy.fromJson(reader);
                        } else if ("attributes".equals(fieldName)) {
                            deserializedCertificateUpdateParameters.certificateAttributes =
                                    CertificateAttributes.fromJson(reader);
                        } else if ("tags".equals(fieldName)) {
                            Map tags = reader.readMap(reader1 -> reader1.getString());
                            deserializedCertificateUpdateParameters.tags = tags;
                        } else {
                            reader.skipChildren();
                        }
                    }

                    return deserializedCertificateUpdateParameters;
                });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy