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

com.azure.security.keyvault.certificates.implementation.models.CertificateCreateParameters 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 create parameters. */
@Fluent
public final class CertificateCreateParameters 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 CertificateCreateParameters class. */
    public CertificateCreateParameters() {}

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

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

                    return deserializedCertificateCreateParameters;
                });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy