Cloud Cost Fitness AWS

A library to express and test your AWS cloud costs as architecture fitness functions.

Лицензия

Лицензия

Категории

Категории

AWS Контейнер PaaS Providers
Группа

Группа

de.qaware.cloud.cost
Идентификатор

Идентификатор

cloud-cost-fitness-aws
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Cloud Cost Fitness AWS
A library to express and test your AWS cloud costs as architecture fitness functions.
Ссылка на сайт

Ссылка на сайт

https://github.com/qaware/cloud-cost-fitness
Организация-разработчик

Организация-разработчик

QAware GmbH
Система контроля версий

Система контроля версий

http://github.com/qaware/cloud-cost-fitness/tree/master

Скачать cloud-cost-fitness-aws

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/de.qaware.cloud.cost/cloud-cost-fitness-aws/ -->
<dependency>
    <groupId>de.qaware.cloud.cost</groupId>
    <artifactId>cloud-cost-fitness-aws</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/de.qaware.cloud.cost/cloud-cost-fitness-aws/
implementation 'de.qaware.cloud.cost:cloud-cost-fitness-aws:1.0.1'
// https://jarcasting.com/artifacts/de.qaware.cloud.cost/cloud-cost-fitness-aws/
implementation ("de.qaware.cloud.cost:cloud-cost-fitness-aws:1.0.1")
'de.qaware.cloud.cost:cloud-cost-fitness-aws:jar:1.0.1'
<dependency org="de.qaware.cloud.cost" name="cloud-cost-fitness-aws" rev="1.0.1">
  <artifact name="cloud-cost-fitness-aws" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.qaware.cloud.cost', module='cloud-cost-fitness-aws', version='1.0.1')
)
libraryDependencies += "de.qaware.cloud.cost" % "cloud-cost-fitness-aws" % "1.0.1"
[de.qaware.cloud.cost/cloud-cost-fitness-aws "1.0.1"]

Зависимости

runtime (4)

Идентификатор библиотеки Тип Версия
software.amazon.awssdk : aws-sdk-java jar 2.15.23
de.qaware.cloud.cost : cloud-cost-fitness-api jar 1.0.1
org.slf4j : slf4j-api jar 1.7.30
org.slf4j : slf4j-simple jar 1.7.30

Модули Проекта

Данный проект не имеет модулей.

Cloud Cost Fitness

Build Status Quality Gate Status Coverage License

A library to express and test your cloud costs as architecture fitness functions.

Usage

Dependency Definition

If you are using Gradle as a build tool the following dependency needs to be added to your project dependencies.

testImplementation 'de.qaware.cloud.cost:cloud-cost-fitness-api:1.0.0'
testRuntimeOnly 'de.qaware.cloud.cost:cloud-cost-fitness-aws:1.0.0'

If you are using Maven as a build tool the following dependency needs to be added to your project dependencies.

<dependency>
    <groupId>de.qaware.cloud.cost</groupId>
    <artifactId>cloud-cost-fitness-api</artifactId>
    <version>1.0.0</version>
    <type>test</type>
</dependency>
<dependency>
    <groupId>de.qaware.cloud.cost</groupId>
    <artifactId>cloud-cost-fitness-aws</artifactId>
    <version>1.0.0</version>
    <type>test</type>
</dependency>

Cloud Cost Fitness Tests using Spock

The Cloud Cost Fitness library can be used nicely in combination with the Spock Framework. Simply define a test specification, create a cost explorer for the desired cloud provider and implement a dedicated test for each cloud cost fitness function.

@Requires({ sys['aws.access.key'] && sys['aws.secret.key'] })
class CloudCostFitnessSpec extends Specification {
    @Shared
    CostExplorer costExplorer = CloudProvider.AMAZON_AWS.getCostExplorer()

    def "checks the total costs"() {
        expect: "the total costs to be less than a limit"
        costExplorer.during(YESTERDAY).getCosts().sum().lessThan(100.0)
    }

    @Unroll
    def "check the costs of EC2 instance #service"() {
        expect: "the cost is less than the limit"
        costExplorer.during(LAST_7_DAYS).forService(service).getCosts().sum().lessThan(250.0)

        where:
        service << costExplorer.forService("Amazon Elastic *").getNames()
    }
}

For the complete example have a look at CloudCostFitnessSpec.groovy found under src/test/groovy/.

Cloud Cost Fitness Tests using JUnit 5

The Cloud Cost Fitness library can also be used nicely in combination with JUnit 5. Simply define a test class, create a cost explorer for the desired cloud provider and implement a dedicated test for each cloud cost fitness function.

@EnabledIfSystemProperty(named = "aws.access.key", matches = ".*")
@EnabledIfSystemProperty(named = "aws.secret.key", matches = ".*")
class CloudCostFitnessTest {

    private static CostExplorer costExplorer;

    @BeforeAll
    static void setUpAll() {
        costExplorer = CloudProvider.AMAZON_AWS.getCostExplorer();
    }

    @Test
    void checkTheTotalCosts() {
        ValueWithUnit sum = costExplorer.during(YESTERDAY).getCosts().sum();
        assertTrue(sum.lessThan(42.0));
    }

    @ParameterizedTest
    @MethodSource("serviceNameFactory")
    void checkTheCostsOfElasticComputeInstance(String service) {
        ValueWithUnit sum = costExplorer.during(LAST_7_DAYS).forService(service).getCosts().sum();
        assertTrue(sum.lessThan(250.0));
    }

    static List<String> serviceNameFactory() {
        return costExplorer.forService("Amazon Elastic *").getNames();
    }
}

For the complete example have a look at CloudCostFitnessTest.java found under src/test/java/.

Maintainer

License

This software is provided under the Apache v2 open source license, read the LICENSE file for details.

de.qaware.cloud.cost

QAware GmbH

QAware ist ein Projekthaus für Softwaretechnik. Wir analysieren, renovieren, erfinden und realisieren Softwaresysteme für Kunden, deren Erfolg von IT abhängt.

Версии библиотеки

Версия
1.0.1