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

com.yahoo.vespa.config.server.tenant.CloudAccountSerializer Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.tenant;

import com.yahoo.config.provision.CloudAccount;
import com.yahoo.slime.Cursor;
import com.yahoo.slime.Inspector;
import com.yahoo.slime.Slime;

/**
 * @author mpolden
 */
public class CloudAccountSerializer {

    private static final String ID_FIELD = "id";

    private CloudAccountSerializer() {}

    public static CloudAccount fromSlime(Inspector object) {
        return CloudAccount.from(object.field(ID_FIELD).asString());
    }

    public static Slime toSlime(CloudAccount account) {
        Slime slime = new Slime();
        Cursor root = slime.setObject();
        root.setString(ID_FIELD, account.value());
        return slime;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy