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

com.yahoo.vespa.hosted.controller.api.integration.billing.PlanRegistry Maven / Gradle / Ivy

There is a newer version: 8.253.3
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.hosted.controller.api.integration.billing;

import java.util.List;
import java.util.Optional;

/**
 * Registry of all current plans we have support for
 *
 * @author ogronnesby
 */
public interface PlanRegistry {

    /** Get the default plan */
    Plan defaultPlan();

    /** Get a plan given a plan ID */
    Optional plan(PlanId planId);

    /** Get a set of all plans */
    List all();

    default Plan require(String planId) {
        return plan(planId).orElseThrow();
    }

    /** Get a plan give a plan ID */
    default Optional plan(String planId) {
        if (planId == null || planId.isBlank())
            return Optional.empty();
        return plan(PlanId.from(planId));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy