Skip to content
Permalink
Browse files
JCLOUDS-1140 oneandone-sharedstorages-api
  • Loading branch information
alibazlamit authored and nacx committed Aug 1, 2016
1 parent b28fe7c commit ff73c4e22953bc6ab14bbbab371ed2cdbcc9230c
Show file tree
Hide file tree
Showing 18 changed files with 1,005 additions and 51 deletions.
@@ -19,6 +19,7 @@
import java.io.Closeable;
import org.apache.jclouds.oneandone.rest.features.ImageApi;
import org.apache.jclouds.oneandone.rest.features.ServerApi;
import org.apache.jclouds.oneandone.rest.features.SharedStorageApi;
import org.jclouds.rest.annotations.Delegate;

public interface OneAndOneApi extends Closeable {
@@ -29,4 +30,6 @@ public interface OneAndOneApi extends Closeable {
@Delegate
ImageApi imageApi();

@Delegate
SharedStorageApi sharedStorageApi();
}
@@ -21,14 +21,15 @@

@AutoValue
public abstract class DataCenter {
public abstract String id();

public abstract String countryCode();
public abstract String id();

public abstract String location();
public abstract String countryCode();

@SerializedNames({"id", "country_code", "location"})
public static DataCenter create(String id, String countryCode, String location) {
return new AutoValue_DataCenter(id, countryCode, location);
}
public abstract String location();

@SerializedNames({"id", "country_code", "location"})
public static DataCenter create(String id, String countryCode, String location) {
return new AutoValue_DataCenter(id, countryCode, location);
}
}
@@ -21,12 +21,13 @@

@AutoValue
public abstract class Dvd {
public abstract String id();

public abstract String name();
public abstract String id();

@SerializedNames({"id", "name"})
public static Dvd create(String id, String name) {
return new AutoValue_Dvd(id, name);
}
public abstract String name();

@SerializedNames({"id", "name"})
public static Dvd create(String id, String name) {
return new AutoValue_Dvd(id, name);
}
}
@@ -106,6 +106,21 @@ public static CriticalAlert create(String type, String description, String date)
}
}

@AutoValue
public abstract static class WarningAlert {

public abstract String type();

public abstract String description();

public abstract Date date();

@SerializedNames({"type", "description", "date"})
public static WarningAlert create(String type, String description, Date date) {
return new AutoValue_Server_WarningAlert(type, description, date);
}
}

@AutoValue
public abstract static class UpdateServerResponse {

@@ -0,0 +1,162 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jclouds.oneandone.rest.domain;

import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import java.util.List;
import org.apache.jclouds.oneandone.rest.domain.Types.StorageServerRights;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;

@AutoValue
public abstract class SharedStorage {

public abstract String id();

public abstract int size();

@Nullable
public abstract String state();

@Nullable
public abstract String description();

@Nullable
public abstract String cloudpanelId();

public abstract int sizeUsed();

@Nullable
public abstract String cifsPath();

@Nullable
public abstract String nfsPath();

public abstract String name();

@Nullable

public abstract String creationDate();

@Nullable
public abstract List<Server> servers();

@SerializedNames({"id", "size", "state", "description", "cloudpanel_id", "size_used", "cifs_path", "nfs_path", "name", "creation_date", "servers"})
public static SharedStorage create(String id, int size, String state, String description, String cloudpanelId, int sizeUsed, String cifsPath, String nfsPath, String name, String creationDate, List<Server> servers) {
return new AutoValue_SharedStorage(id, size, state, description, cloudpanelId, sizeUsed, cifsPath, nfsPath, name, creationDate, servers == null ? ImmutableList.<Server>of() : ImmutableList.copyOf(servers));
}

@AutoValue
public abstract static class CreateSharedStorage {

public abstract String name();

@Nullable
public abstract String description();

public abstract int size();

@Nullable
public abstract String datacenterId();

@SerializedNames({"name", "description", "size", "datacenter_id"})
public static CreateSharedStorage create(final String name, final String description, final int size, final String dataCenterId) {
return builder()
.name(name)
.description(description)
.datacenterId(dataCenterId)
.size(size)
.build();
}

public static Builder builder() {
return new AutoValue_SharedStorage_CreateSharedStorage.Builder();
}

@AutoValue.Builder
public abstract static class Builder {

public abstract Builder name(String name);

public abstract Builder description(String description);

public abstract Builder size(int size);

public abstract Builder datacenterId(String datacenterId);

public abstract CreateSharedStorage build();
}
}

@AutoValue
public abstract static class UpdateSharedStorage {

@Nullable
public abstract String name();

@Nullable
public abstract String description();

@Nullable
public abstract Integer size();

@SerializedNames({"name", "description", "size"})
public static UpdateSharedStorage create(final String name, final String description, final Integer size) {
return new AutoValue_SharedStorage_UpdateSharedStorage(name, description, size);
}
}

@AutoValue
public abstract static class Server {

public abstract String id();

public abstract String name();

public abstract StorageServerRights rights();

@SerializedNames({"id", "name", "rights"})
public static Server create(String id, String name, StorageServerRights rights) {
return new AutoValue_SharedStorage_Server(id, name, rights);
}

@AutoValue
public abstract static class CreateServer {

public abstract List<ServerPayload> servers();

@SerializedNames({"servers"})
public static CreateServer create(final List<ServerPayload> servers) {
return new AutoValue_SharedStorage_Server_CreateServer(servers);
}

@AutoValue
public abstract static class ServerPayload {

public abstract String id();

public abstract StorageServerRights rights();

@SerializedNames({"id", "rights"})
public static ServerPayload create(final String id, StorageServerRights rights) {
return new AutoValue_SharedStorage_Server_CreateServer_ServerPayload(id, rights);
}
}
}
}
}
@@ -0,0 +1,52 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jclouds.oneandone.rest.domain;

import com.google.auto.value.AutoValue;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;

@AutoValue
public abstract class SharedStorageAccess {

@Nullable
public abstract DataCenter datacenter();

public abstract String state();

public abstract String kerberosContentFile();

public abstract int needsPasswordReset();

public abstract String userDomain();

@SerializedNames({"datacenter", "state", "kerberos_content_file", "needs_password_reset", "user_domain"})
public static SharedStorageAccess create(DataCenter datacenter, String state, String kerberosContentFile, int needsPasswordReset, String user_domain) {
return new AutoValue_SharedStorageAccess(datacenter, state, kerberosContentFile, needsPasswordReset, user_domain);
}

@AutoValue
public abstract static class UpdateSharedStorageAccess {

public abstract String password();

@SerializedNames({"password"})
public static UpdateSharedStorageAccess create(final String password) {
return new AutoValue_SharedStorageAccess_UpdateSharedStorageAccess(password);
}
}
}
@@ -136,6 +136,15 @@ public enum IPType {
public static IPType fromValue(String v) {
return Enums.getIfPresent(IPType.class, v).or(UNRECOGNIZED);
}
}

public enum StorageServerRights {
R,
RW,
UNRECOGNIZED;

public static StorageServerRights fromValue(String v) {
return Enums.getIfPresent(StorageServerRights.class, v).or(UNRECOGNIZED);
}
}
}

This file was deleted.

0 comments on commit ff73c4e

Please sign in to comment.