CenturyLink sdk spring adapter

CenturyLink Java Sdk spring adapter

License

License

GroupId

GroupId

com.centurylink.cloud
ArtifactId

ArtifactId

clc-sdk-spring-adapter
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

CenturyLink sdk spring adapter
CenturyLink Java Sdk spring adapter
Project URL

Project URL

https://github.com/CenturyLinkCloud/clc-java-sdk
Source Code Management

Source Code Management

https://github.com/CenturyLinkCloud/clc-java-sdk

Download clc-sdk-spring-adapter

How to add to project

<!-- https://jarcasting.com/artifacts/com.centurylink.cloud/clc-sdk-spring-adapter/ -->
<dependency>
    <groupId>com.centurylink.cloud</groupId>
    <artifactId>clc-sdk-spring-adapter</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.centurylink.cloud/clc-sdk-spring-adapter/
implementation 'com.centurylink.cloud:clc-sdk-spring-adapter:1.1.0'
// https://jarcasting.com/artifacts/com.centurylink.cloud/clc-sdk-spring-adapter/
implementation ("com.centurylink.cloud:clc-sdk-spring-adapter:1.1.0")
'com.centurylink.cloud:clc-sdk-spring-adapter:jar:1.1.0'
<dependency org="com.centurylink.cloud" name="clc-sdk-spring-adapter" rev="1.1.0">
  <artifact name="clc-sdk-spring-adapter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.centurylink.cloud', module='clc-sdk-spring-adapter', version='1.1.0')
)
libraryDependencies += "com.centurylink.cloud" % "clc-sdk-spring-adapter" % "1.1.0"
[com.centurylink.cloud/clc-sdk-spring-adapter "1.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.springframework : spring-context jar 4.2.1.RELEASE
com.centurylink.cloud : clc-java-sdk jar 1.1.0

test (3)

Group / Artifact Type Version
org.testng : testng jar 6.8.21
org.apache.logging.log4j : log4j-core jar 2.2
org.apache.logging.log4j : log4j-slf4j-impl jar 2.2

Project Modules

There are no modules declared in this project.

Documentation

See the wiki for CLC Java SDK getting-started and user guides.

SDK Installation

If you use Maven or Gradle, you can simply add the CLC SDK as a dependency.

Maven:

<dependencies>
    <dependency>
        <groupId>com.centurylink.cloud</groupId>
        <artifactId>clc-java-sdk</artifactId>
        <version>1.2.3</version>
    </dependency>
</dependencies>

Gradle:

compile 'com.centurylink.cloud:clc-java-sdk:1.2.1'

SDK with spring adapter installation

Add spring clc sdk as dependency

Maven:

<dependencies>
    <dependency>
        <groupId>com.centurylink.cloud</groupId>
        <artifactId>spring-clc-sdk</artifactId>
        <version>1.2.3</version>
    </dependency>
</dependencies>

Gradle:

compile 'com.centurylink.cloud:spring-clc-sdk:1.2.3'

Provide credentials and config

@Configuration
@EnableClcSdk
class MyConfig {

    @Bean
    public CredentialsProvider clcCredentialsProvider() {
        return new StaticCredentialsProvider("john.doe", "strong_password");
    }

    @Bean
    public SdkConfiguration clcSdkConfig() {
        return new SdkConfigurationBuilder().build();
    }

}

Then you can autowire necessary sdk services

@Autowired
ServerService serverService;

@Autowired
GroupService groupService;

Configuration

Please see the SDK configuration section for details and examples of how to configure the CLC SDK.

Example

This example shows some of the functionality supported by the CLC Java SDK.

import static com.centurylink.cloud.sdk.servers.services.domain.InfrastructureConfig.dataCenter;

...
ClcSdk sdk = new ClcSdk("user", "password");

ServerService serverService = sdk.serverService();
GroupService groupService = sdk.groupService();

serverService
    .create(new CreateServerConfig()
        .name("TCRT")
        .type(STANDARD)
        .group(Group.refByName()
            .name(DEFAULT_GROUP)
            .dataCenter(DE1_FRANKFURT)
        )
        .machine(new Machine()
            .cpuCount(1)
            .ram(3)
        )
        .template(Template.refByOs()
            .dataCenter(DE_FRANKFURT)
            .type(CENTOS)
            .version("6")
            .architecture(x86_64)
        )
        .network(new NetworkConfig()
            .primaryDns("172.17.1.26")
            .secondaryDns("172.17.1.27")
        )
    )
    .waitUntilComplete();

Build Process

To build sources, you need to install Gradle 2.2.1 or later. To check out and build the CLC SDK source, issue the following commands:

$ git clone [email protected]:CenturyLinkCloud/clc-java-sdk.git
$ cd clc-java-sdk
$ gradle build

License

This project is licensed under the Apache License v2.0.

com.centurylink.cloud

CenturyLink Cloud

Versions

Version
1.1.0