You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2018/01/08 14:55:53 UTC
[12/21] jclouds-labs git commit: Promoted Azure ARM to the main repo
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VaultApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VaultApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VaultApi.java
deleted file mode 100644
index 5ae39ba..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VaultApi.java
+++ /dev/null
@@ -1,635 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.features;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import com.google.common.base.Function;
-
-import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.azurecompute.arm.config.OAuthResource;
-import org.jclouds.azurecompute.arm.domain.Certificate;
-import org.jclouds.azurecompute.arm.domain.Certificate.CertificateAttributes;
-import org.jclouds.azurecompute.arm.domain.Certificate.CertificateBundle;
-import org.jclouds.azurecompute.arm.domain.Certificate.CertificateIssuer;
-import org.jclouds.azurecompute.arm.domain.Certificate.CertificateOperation;
-import org.jclouds.azurecompute.arm.domain.Certificate.CertificatePolicy;
-import org.jclouds.azurecompute.arm.domain.Certificate.Contact;
-import org.jclouds.azurecompute.arm.domain.Certificate.Contacts;
-import org.jclouds.azurecompute.arm.domain.Certificate.DeletedCertificate;
-import org.jclouds.azurecompute.arm.domain.Certificate.DeletedCertificateBundle;
-import org.jclouds.azurecompute.arm.domain.Certificate.IssuerAttributes;
-import org.jclouds.azurecompute.arm.domain.Certificate.IssuerBundle;
-import org.jclouds.azurecompute.arm.domain.Certificate.IssuerCredentials;
-import org.jclouds.azurecompute.arm.domain.Certificate.IssuerParameters;
-import org.jclouds.azurecompute.arm.domain.Certificate.KeyProperties;
-import org.jclouds.azurecompute.arm.domain.Certificate.LifetimeAction;
-import org.jclouds.azurecompute.arm.domain.Certificate.OrganizationDetails;
-import org.jclouds.azurecompute.arm.domain.Certificate.SecretProperties;
-import org.jclouds.azurecompute.arm.domain.Certificate.X509CertificateProperties;
-import org.jclouds.azurecompute.arm.domain.Key;
-import org.jclouds.azurecompute.arm.domain.Key.DeletedKeyBundle;
-import org.jclouds.azurecompute.arm.domain.Key.JsonWebKey;
-import org.jclouds.azurecompute.arm.domain.Key.KeyAttributes;
-import org.jclouds.azurecompute.arm.domain.Key.KeyBundle;
-import org.jclouds.azurecompute.arm.domain.Key.KeyOperationResult;
-import org.jclouds.azurecompute.arm.domain.Secret;
-import org.jclouds.azurecompute.arm.domain.Secret.DeletedSecretBundle;
-import org.jclouds.azurecompute.arm.domain.Secret.SecretAttributes;
-import org.jclouds.azurecompute.arm.domain.Secret.SecretBundle;
-import org.jclouds.azurecompute.arm.domain.Vault;
-import org.jclouds.azurecompute.arm.domain.Vault.DeletedVault;
-import org.jclouds.azurecompute.arm.domain.VaultProperties;
-import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PATCH;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-import org.jclouds.rest.annotations.ParamParser;
-
-@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
-@Consumes(MediaType.APPLICATION_JSON)
-public interface VaultApi {
- static class PrependSlashOrEmptyString implements Function<Object, String> {
- public String apply(Object from) {
- if ((from == null) || (from.toString().length() == 0)) {
- return "";
- } else {
- return "/" + from.toString();
- }
- }
- }
-
- // Vault operations
- @Named("vault:list")
- @SelectJson("value")
- @GET
- @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.KeyVault/vaults")
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<Vault> listVaults();
-
- @Named("vault:create_or_update")
- @PUT
- @MapBinder(BindToJsonPayload.class)
- @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.KeyVault/vaults/{vaultName}")
- Vault createOrUpdateVault(@PathParam("vaultName") String vaultName, @PayloadParam("location") String location,
- @PayloadParam("properties") VaultProperties properties, @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("vault:get")
- @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.KeyVault/vaults/{vaultName}")
- @GET
- @Fallback(NullOnNotFoundOr404.class)
- Vault getVault(@PathParam("vaultName") String vaultName);
-
- @Named("vault:delete")
- @Path("/resourcegroups/{resourcegroup}/providers/Microsoft.KeyVault/vaults/{vaultName}")
- @DELETE
- @Fallback(FalseOnNotFoundOr404.class)
- boolean deleteVault(@PathParam("vaultName") String vaultName);
-
- @Named("vault:list_deleted_vaults")
- @Path("/providers/Microsoft.KeyVault/deletedVaults")
- @GET
- @SelectJson("value")
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<DeletedVault> listDeletedVaults();
-
- @Named("vault:get_deleted")
- @GET
- @Path("/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}")
- @Fallback(NullOnNotFoundOr404.class)
- DeletedVault getDeletedVault(@PathParam("location") String location, @PathParam("vaultName") String vaultName);
-
- @Named("vault:purge")
- @POST
- @Fallback(FalseOnNotFoundOr404.class)
- @Path("/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge")
- boolean purgeVault(@PathParam("location") String location, @PathParam("vaultName") String vaultName);
-
- // Key operations
- @Named("key:list")
- @SelectJson("value")
- @GET
- @Fallback(EmptyListOnNotFoundOr404.class)
- @Path("/keys")
- @OAuthResource("https://vault.azure.net")
- List<Key> listKeys(@EndpointParam URI keyVaultUri);
-
- @Named("key:create")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/keys/{keyName}/create")
- @OAuthResource("https://vault.azure.net")
- KeyBundle createKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName,
- @Nullable @PayloadParam("attributes") KeyAttributes attributes,
- @Nullable @PayloadParam("crv") String curveName, @Nullable @PayloadParam("key_ops") List<String> keyOps,
- @PayloadParam("key_size") int keySize, @PayloadParam("kty") String keyType,
- @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("key:import")
- @PUT
- @MapBinder(BindToJsonPayload.class)
- @Path("/keys/{keyName}")
- @OAuthResource("https://vault.azure.net")
- KeyBundle importKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName,
- @PayloadParam("Hsm") boolean hsm, @Nullable @PayloadParam("attributes") KeyAttributes attributes,
- @Nullable @PayloadParam("key") JsonWebKey key, @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("key:get")
- @GET
- @Path("/keys/{keyName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- KeyBundle getKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:delete")
- @DELETE
- @Path("/keys/{keyName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedKeyBundle deleteKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:get_versions")
- @GET
- @SelectJson("value")
- @Path("/keys/{keyName}/versions")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<Key> getKeyVersions(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:update")
- @PATCH
- @MapBinder(BindToJsonPayload.class)
- @Path("/keys/{keyName}{keyVersion}")
- @OAuthResource("https://vault.azure.net")
- KeyBundle updateKey(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @Nullable @PayloadParam("attributes") KeyAttributes attributes,
- @Nullable @PayloadParam("key_ops") List<String> keyOps,
- @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("key:backup")
- @POST
- @SelectJson("value")
- @Path("/keys/{keyName}/backup")
- @OAuthResource("https://vault.azure.net")
- String backupKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:restore")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/keys/restore")
- @OAuthResource("https://vault.azure.net")
- KeyBundle restoreKey(@EndpointParam URI vaultBaseUrl, @PayloadParam("value") String keyInfo);
-
- // Soft-delete key operations
- @Named("key:list_deleted")
- @GET
- @SelectJson("value")
- @Path("/deletedkeys")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<DeletedKeyBundle> listDeletedKeys(@EndpointParam URI vaultBaseUrl);
-
- @Named("key:get_deleted")
- @GET
- @Path("/deletedkeys/{keyName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedKeyBundle getDeletedKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:recover_deleted")
- @POST
- @Path("/deletedkeys/{keyName}/recover")
- @OAuthResource("https://vault.azure.net")
- KeyBundle recoverDeletedKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- @Named("key:purge_deleted")
- @DELETE
- @Path("/deletedkeys/{keyName}")
- @Fallback(FalseOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- boolean purgeDeletedKey(@EndpointParam URI vaultBaseUrl, @PathParam("keyName") String keyName);
-
- // Key cryptographic operations
- @Named("key:crypto_encrypt")
- @POST
- @Path("/keys/{keyName}{keyVersion}/encrypt")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- KeyOperationResult encrypt(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("value") String value);
-
- @Named("key:crypto_decrypt")
- @POST
- @Path("/keys/{keyName}{keyVersion}/decrypt")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- KeyOperationResult decrypt(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("value") String value);
-
- @Named("key:crypto_sign")
- @POST
- @Path("/keys/{keyName}{keyVersion}/sign")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- KeyOperationResult sign(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("value") String value);
-
- @Named("key:crypto_verify")
- @POST
- @Path("/keys/{keyName}{keyVersion}/verify")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- boolean verify(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("digest") String digest,
- @PayloadParam("value") String value);
-
- @Named("key:crypto_wrap")
- @POST
- @Path("/keys/{keyName}{keyVersion}/wrapkey")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- KeyOperationResult wrap(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("value") String value);
-
- @Named("key:crypto_unwrap")
- @POST
- @Path("/keys/{keyName}{keyVersion}/unwrapkey")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- KeyOperationResult unwrap(@EndpointParam URI vaultBaseUrl,
- @PathParam("keyName") String keyName,
- @Nullable @PathParam("keyVersion") @ParamParser(PrependSlashOrEmptyString.class) String keyVersion,
- @PayloadParam("alg") String algorithm,
- @PayloadParam("value") String value);
-
- // Secret operations
- @Named("secret:list")
- @SelectJson("value")
- @GET
- @Fallback(EmptyListOnNotFoundOr404.class)
- @Path("/secrets")
- @OAuthResource("https://vault.azure.net")
- List<Secret> listSecrets(@EndpointParam URI keyVaultUri);
-
- @Named("secret:set")
- @PUT
- @MapBinder(BindToJsonPayload.class)
- @Path("/secrets/{secretName}")
- @OAuthResource("https://vault.azure.net")
- SecretBundle setSecret(@EndpointParam URI keyVaultUri, @PathParam("secretName") String secretName,
- @Nullable @PayloadParam("attributes") SecretAttributes attributes,
- @Nullable @PayloadParam("contentType") String contentType,
- @Nullable @PayloadParam("tags") Map<String, String> tags, @PayloadParam("value") String value);
-
- @Named("secret:get")
- @GET
- @Path("/secrets/{secretName}{secretVersion}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- SecretBundle getSecret(@EndpointParam URI vaultBaseUrl,
- @PathParam("secretName") String secretName,
- @Nullable @PathParam("secretVersion") @ParamParser(PrependSlashOrEmptyString.class) String secretVersion);
-
- @Named("secret:delete")
- @DELETE
- @Path("/secrets/{secretName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedSecretBundle deleteSecret(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- @Named("secret:get_versions")
- @GET
- @SelectJson("value")
- @Path("/secrets/{secretName}/versions")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<Secret> getSecretVersions(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- @Named("secret:update")
- @PATCH
- @MapBinder(BindToJsonPayload.class)
- @Path("/secrets/{secretName}{secretVersion}")
- @OAuthResource("https://vault.azure.net")
- SecretBundle updateSecret(@EndpointParam URI vaultBaseUrl,
- @PathParam("secretName") String secretName,
- @Nullable @PathParam("secretVersion") @ParamParser(PrependSlashOrEmptyString.class) String secretVersion,
- @Nullable @PayloadParam("attributes") SecretAttributes attributes,
- @Nullable @PayloadParam("contentType") String contentType,
- @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("secret:backup")
- @POST
- @SelectJson("value")
- @Path("/secrets/{secretName}/backup")
- @OAuthResource("https://vault.azure.net")
- String backupSecret(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- @Named("secret:restore")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/secrets/restore")
- @OAuthResource("https://vault.azure.net")
- SecretBundle restoreSecret(@EndpointParam URI vaultBaseUrl, @PayloadParam("value") String secretInfo);
-
- // Soft-delete secret operations
- @Named("secret:list_deleted")
- @GET
- @SelectJson("value")
- @Path("/deletedsecrets")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<DeletedSecretBundle> listDeletedSecrets(@EndpointParam URI vaultBaseUrl);
-
- @Named("secret:get_deleted")
- @GET
- @Path("/deletedsecrets/{secretName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedSecretBundle getDeletedSecret(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- @Named("secret:recover_deleted")
- @POST
- @Path("/deletedsecrets/{secretName}/recover")
- @OAuthResource("https://vault.azure.net")
- SecretBundle recoverDeletedSecret(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- @Named("secret:purge_deleted")
- @DELETE
- @Path("/deletedsecrets/{secretName}")
- @Fallback(FalseOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- boolean purgeDeletedSecret(@EndpointParam URI vaultBaseUrl, @PathParam("secretName") String secretName);
-
- // Certificate operations
- @Named("certificate:create")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/certificates/{certificateName}/create")
- @OAuthResource("https://vault.azure.net")
- CertificateOperation createCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PayloadParam("attributes") CertificateAttributes attributes,
- @Nullable @PayloadParam("policy") CertificatePolicy policy,
- @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("certificate:get")
- @GET
- @Path("/certificates/{certificateName}{certificateVersion}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- CertificateBundle getCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PathParam("certificateVersion") @ParamParser(PrependSlashOrEmptyString.class) String certificateVersion);
-
- @Named("certificate:delete")
- @DELETE
- @Path("/certificates/{certificateName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedCertificateBundle deleteCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:list")
- @GET
- @SelectJson("value")
- @Path("/certificates")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<Certificate> getCertificates(@EndpointParam URI vaultBaseUrl);
-
- @Named("certificate:list_deleted")
- @GET
- @SelectJson("value")
- @Path("/deletedcertificates")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<DeletedCertificate> getDeletedCertificates(@EndpointParam URI vaultBaseUrl);
-
- @Named("certificate:get_deleted")
- @GET
- @Path("/deletedcertificates/{certificateName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- DeletedCertificateBundle getDeletedCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:recover_deleted")
- @POST
- @Path("/deletedcertificates/{certificateName}/recover")
- @OAuthResource("https://vault.azure.net")
- CertificateBundle recoverDeletedCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:purge_deleted")
- @DELETE
- @Path("/deletedcertificates/{certificateName}")
- @Fallback(FalseOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- boolean purgeDeletedCertificate(@EndpointParam URI vaultBaseUrl, @PathParam("certificateName") String certificateName);
-
- @Named("certificate:get_versions")
- @GET
- @SelectJson("value")
- @Path("/certificates/{certificateName}/versions")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<Certificate> getCertificateVersions(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:update")
- @PATCH
- @MapBinder(BindToJsonPayload.class)
- @Path("/certificates/{certificateName}{certificateVersion}")
- @OAuthResource("https://vault.azure.net")
- CertificateBundle updateCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PathParam("certificateVersion") @ParamParser(PrependSlashOrEmptyString.class) String certificateVersion,
- @Nullable @PayloadParam("attributes") CertificateAttributes attributes,
- @Nullable @PayloadParam("policy") CertificatePolicy policy,
- @Nullable @PayloadParam("tags") Map<String, String> tags);
-
- @Named("certificate:import")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/certificates/{certificateName}/import")
- @OAuthResource("https://vault.azure.net")
- CertificateBundle importCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PayloadParam("attributes") CertificateAttributes attributes,
- @Nullable @PayloadParam("policy") CertificatePolicy policy, @Nullable @PayloadParam("pwd") String password,
- @Nullable @PayloadParam("tags") Map<String, String> tags, @PayloadParam("value") String value);
-
- @Named("certificate:merge")
- @POST
- @MapBinder(BindToJsonPayload.class)
- @Path("/certificates/{certificateName}/pending/merge")
- @OAuthResource("https://vault.azure.net")
- CertificateBundle mergeCertificate(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PayloadParam("attributes") CertificateAttributes attributes,
- @Nullable @PayloadParam("tags") Map<String, String> tags, @PayloadParam("x5c") List<String> value);
-
- @Named("certificate:get_operation")
- @GET
- @Path("/certificates/{certificateName}/pending")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- CertificateOperation getCertificateOperation(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:update_operation")
- @PATCH
- @Path("/certificates/{certificateName}/pending")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- CertificateOperation updateCertificateOperation(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @PayloadParam("cancellation_requested") boolean cancellationRequested);
-
- @Named("certificate:delete_operation")
- @DELETE
- @Path("/certificates/{certificateName}/pending")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- CertificateOperation deleteCertificateOperation(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:set_issuer")
- @PUT
- @Path("/certificates/issuers/{issuerName}")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- IssuerBundle setCertificateIssuer(@EndpointParam URI vaultBaseUrl, @PathParam("issuerName") String issuerName,
- @Nullable @PayloadParam("attributes") IssuerAttributes attributes,
- @Nullable @PayloadParam("credentials") IssuerCredentials credentials,
- @Nullable @PayloadParam("org_details") OrganizationDetails orgDetails,
- @PayloadParam("provider") String provider);
-
- @Named("certificate:get_issuers")
- @GET
- @SelectJson("value")
- @Path("/certificates/issuers")
- @Fallback(EmptyListOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- List<CertificateIssuer> getCertificateIssuers(@EndpointParam URI vaultBaseUrl);
-
- @Named("certificate:get_issuer")
- @GET
- @Path("/certificates/issuers/{issuerName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- IssuerBundle getCertificateIssuer(@EndpointParam URI vaultBaseUrl, @PathParam("issuerName") String issuerName);
-
- @Named("certificate:update_issuer")
- @PATCH
- @Path("/certificates/issuers/{issuerName}")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- IssuerBundle updateCertificateIssuer(@EndpointParam URI vaultBaseUrl, @PathParam("issuerName") String issuerName,
- @Nullable @PayloadParam("attributes") IssuerAttributes attributes,
- @Nullable @PayloadParam("credentials") IssuerCredentials credentials,
- @Nullable @PayloadParam("org_details") OrganizationDetails orgDetails,
- @PayloadParam("provider") String provider);
-
- @Named("certificate:delete_issuer")
- @DELETE
- @Path("/certificates/issuers/{issuerName}")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- IssuerBundle deleteCertificateIssuer(@EndpointParam URI vaultBaseUrl, @PathParam("issuerName") String issuerName);
-
- @Named("certificate:get_contacts")
- @GET
- @Path("/certificates/contacts")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- Contacts getCertificateContacts(@EndpointParam URI vaultBaseUrl);
-
- @Named("certificate:set_contacts")
- @PUT
- @Path("/certificates/contacts")
- @MapBinder(BindToJsonPayload.class)
- @OAuthResource("https://vault.azure.net")
- Contacts setCertificateContacts(@EndpointParam URI vaultBaseUrl, @PayloadParam("contacts") List<Contact> contacts);
-
- @Named("certificate:delete_contacts")
- @DELETE
- @Path("/certificates/contacts")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- Contacts deleteCertificateContacts(@EndpointParam URI vaultBaseUrl);
-
- @Named("certificate:get_policy")
- @GET
- @Path("/certificates/{certificateName}/policy")
- @Fallback(NullOnNotFoundOr404.class)
- @OAuthResource("https://vault.azure.net")
- CertificatePolicy getCertificatePolicy(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName);
-
- @Named("certificate:update_policy")
- @PATCH
- @MapBinder(BindToJsonPayload.class)
- @Path("/certificates/{certificateName}/policy")
- @OAuthResource("https://vault.azure.net")
- CertificatePolicy updateCertificatePolicy(@EndpointParam URI vaultBaseUrl,
- @PathParam("certificateName") String certificateName,
- @Nullable @PayloadParam("attributes") CertificateAttributes attributes,
- @Nullable @PayloadParam("issuer") IssuerParameters issuer,
- @Nullable @PayloadParam("key_props") KeyProperties keyProps,
- @Nullable @PayloadParam("lifetime_actions") List<LifetimeAction> lifetimeActions,
- @Nullable @PayloadParam("secret_props") SecretProperties secretProps,
- @Nullable @PayloadParam("x509_props") X509CertificateProperties x509Props);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java
deleted file mode 100644
index 39ed860..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineApi.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.features;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks;
-import org.jclouds.azurecompute.arm.domain.Plan;
-import org.jclouds.azurecompute.arm.domain.VirtualMachine;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineInstance;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineProperties;
-import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
-import org.jclouds.azurecompute.arm.functions.URIParser;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.Payload;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.QueryParams;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-/**
- * The Virtual Machine API includes operations for managing the virtual machines in your subscription.
- *
- * @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-rest-api">docs</a>
- */
-@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines")
-@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
-@Consumes(MediaType.APPLICATION_JSON)
-public interface VirtualMachineApi {
-
- @Named("GetVirtualMachine")
- @GET
- @Path("/{name}")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VirtualMachine get(@PathParam("name") String name);
-
- /**
- * Get information about the model view and instance view of a virtual machine
- */
- @Named("GetVirtualMachineInstance")
- @GET
- @Path("/{name}/instanceView")
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- VirtualMachineInstance getInstanceDetails(@PathParam("name") String name);
-
- @Named("CreateOrUpdateVirtualMachine")
- @PUT
- @MapBinder(BindToJsonPayload.class)
- @Path("/{vmname}")
- @QueryParams(keys = "validating", values = "false")
- VirtualMachine createOrUpdate(@PathParam("vmname") String vmname,
- @PayloadParam("location") String location,
- @PayloadParam("properties") VirtualMachineProperties properties,
- @PayloadParam("tags") Map<String, String> tags,
- @Nullable @PayloadParam("plan") Plan plan);
-
- @Named("ListVirtualMachines")
- @GET
- @SelectJson("value")
- @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
- List<VirtualMachine> list();
-
- @Named("DeleteVirtualMachine")
- @DELETE
- @Path("/{name}")
- @ResponseParser(URIParser.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- URI delete(@PathParam("name") String name);
-
- @Named("RestartVirtualMachine")
- @POST
- @Path("/{name}/restart")
- void restart(@PathParam("name") String name);
-
- @Named("StartVirtualMachine")
- @POST
- @Path("/{name}/start")
- void start(@PathParam("name") String name);
-
- @Named("StopVirtualMachine")
- @POST
- @Path("/{name}/powerOff")
- void stop(@PathParam("name") String name);
-
- @Named("generalize")
- @POST
- @Path("/{name}/generalize")
- void generalize(@PathParam("name") String name);
-
- /**
- * Capture the virtual machine image
- * destinationContainerName: the name of the folder created under the "system" container in the storage account
- * Folder structure: Microsoft.Computer > Images > destinationContainerName
- * Within the folder, there will be 1 page blob for the osDisk vhd and 1 block blob for the vmTemplate json file
- */
- @Named("capture")
- @POST
- @Payload("%7B\"vhdPrefix\":\"{vhdPrefix}\",\"destinationContainerName\":\"{destinationContainerName}\",\"overwriteVhds\":\"true\"%7D")
- @Path("/{name}/capture")
- @ResponseParser(URIParser.class)
- @Fallback(Fallbacks.NullOnNotFoundOr404.class)
- @Produces(MediaType.APPLICATION_JSON)
- URI capture(@PathParam("name") String name,
- @PayloadParam("vhdPrefix") String vhdPrefix,
- @PayloadParam("destinationContainerName") String destinationContainerName);
-
-}
-
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineScaleSetApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineScaleSetApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineScaleSetApi.java
deleted file mode 100644
index f6a237f..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualMachineScaleSetApi.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.features;
-
-import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSet;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetProperties;
-import org.jclouds.azurecompute.arm.domain.VirtualMachineScaleSetSKU;
-import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
-import org.jclouds.azurecompute.arm.functions.URIParser;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-import java.io.Closeable;
-import java.net.URI;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The Virtual Machine Scale Set API includes operations for managing the virtual machines in your subscription.
- *
- * @see <a href="https://docs.microsoft.com/en-us/rest/api/virtualmachinescalesets/">docs</a>
- */
-@Path("/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/VirtualMachineScaleSets")
-@RequestFilters({OAuthFilter.class, ApiVersionFilter.class})
-@Consumes(MediaType.APPLICATION_JSON)
-public interface VirtualMachineScaleSetApi extends Closeable {
-
- @Named("virtualmachinescaleset:list")
- @GET
- @SelectJson("value")
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<VirtualMachineScaleSet> list();
-
- @Named("virtualmachinescaleset:get")
- @Path("/{name}")
- @GET
- @Fallback(NullOnNotFoundOr404.class)
- VirtualMachineScaleSet get(@PathParam("name") String name);
-
- @Named("virtualmachinescaleset:createOrUpdate")
- @MapBinder(BindToJsonPayload.class)
- @Path("/{name}")
- @PUT
- VirtualMachineScaleSet createOrUpdate(@PathParam("name") String name,
- @PayloadParam("location") String location,
- @PayloadParam("sku") VirtualMachineScaleSetSKU sku,
- @Nullable @PayloadParam("tags") Map<String, String> tags,
- @PayloadParam("properties") VirtualMachineScaleSetProperties properties);
-
- @Named("virtualmachinescaleset:delete")
- @Path("/{name}")
- @DELETE
- @ResponseParser(URIParser.class)
- @Fallback(NullOnNotFoundOr404.class)
- URI delete(@PathParam("name") String name);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApi.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApi.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApi.java
deleted file mode 100644
index a4237ff..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/features/VirtualNetworkApi.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.features;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.Fallbacks.EmptyListOnNotFoundOr404;
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.azurecompute.arm.domain.VirtualNetwork;
-import org.jclouds.azurecompute.arm.filters.ApiVersionFilter;
-import org.jclouds.azurecompute.arm.functions.FalseOn204;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.filters.OAuthFilter;
-import org.jclouds.rest.annotations.Fallback;
-import org.jclouds.rest.annotations.MapBinder;
-import org.jclouds.rest.annotations.PayloadParam;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SelectJson;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-@Path("/resourcegroups/{resourcegroup}/providers/Microsoft.Network/virtualNetworks")
-@RequestFilters({ OAuthFilter.class, ApiVersionFilter.class })
-@Consumes(MediaType.APPLICATION_JSON)
-public interface VirtualNetworkApi {
-
- @Named("virtualnetwork:list")
- @SelectJson("value")
- @GET
- @Fallback(EmptyListOnNotFoundOr404.class)
- List<VirtualNetwork> list();
-
- @Named("virtualnetwork:create_or_update")
- @Path("/{virtualnetworkname}")
- @MapBinder(BindToJsonPayload.class)
- @PUT
- VirtualNetwork createOrUpdate(@PathParam("virtualnetworkname") String virtualnetworkname,
- @PayloadParam("location") String location,
- @Nullable @PayloadParam("tags") Map<String, String> tags,
- @PayloadParam("properties")VirtualNetwork.VirtualNetworkProperties properties);
-
- @Named("virtualnetwork:get")
- @Path("/{virtualnetworkname}")
- @GET
- @Fallback(NullOnNotFoundOr404.class)
- VirtualNetwork get(@PathParam("virtualnetworkname") String virtualnetworkname);
-
- @Named("virtualnetwork:delete")
- @Path("/{virtualnetworkname}")
- @DELETE
- @ResponseParser(FalseOn204.class)
- boolean delete(@PathParam("virtualnetworkname") String virtualnetworkname);
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/filters/ApiVersionFilter.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/filters/ApiVersionFilter.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/filters/ApiVersionFilter.java
deleted file mode 100644
index 904c2e8..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/filters/ApiVersionFilter.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.filters;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.API_VERSION_PREFIX;
-import static org.jclouds.util.Maps2.transformKeys;
-import static org.jclouds.util.Predicates2.startsWith;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.rest.config.InvocationConfig;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.reflect.Invokable;
-
-/**
- * Allow users to customize the api versions for each method call.
- * <p>
- * In Azure ARM, each method may have its own api version. This filter allows to
- * configure the versions of each method, so there is no need to change the code
- * when Azure deprecates old versions.
- */
-public class ApiVersionFilter implements HttpRequestFilter {
-
- private final InvocationConfig config;
- private final Map<String, String> versions;
-
- @Inject
- ApiVersionFilter(InvocationConfig config, Function<Predicate<String>, Map<String, String>> filterStringsBoundByName) {
- this.config = config;
- this.versions = versions(filterStringsBoundByName);
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- checkArgument(request instanceof GeneratedHttpRequest,
- "This filter can only be applied to GeneratedHttpRequest objects");
- GeneratedHttpRequest generatedRequest = (GeneratedHttpRequest) request;
-
- // Look if there is a custom api version for the current method
- String commandName = config.getCommandName(generatedRequest.getInvocation());
- String customApiVersion = versions.get(commandName);
-
- if (customApiVersion == null) {
- // No custom config for the specific method. Let's look for custom
- // config for the class
- Invokable<?, ?> invoked = generatedRequest.getInvocation().getInvokable();
- String className = invoked.getOwnerType().getRawType().getSimpleName();
- customApiVersion = versions.get(className);
- }
-
- if (customApiVersion != null) {
- return request.toBuilder().replaceQueryParam("api-version", customApiVersion).build();
- }
-
- return request;
- }
-
- private static Map<String, String> versions(Function<Predicate<String>, Map<String, String>> filterStringsBoundByName) {
- Map<String, String> stringBoundWithApiVersionPrefix = filterStringsBoundByName
- .apply(startsWith(API_VERSION_PREFIX));
- return transformKeys(stringBoundWithApiVersionPrefix, new Function<String, String>() {
- public String apply(String input) {
- return input.replaceFirst(API_VERSION_PREFIX, "");
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/FalseOn204.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/FalseOn204.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/FalseOn204.java
deleted file mode 100644
index 6b73260..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/FalseOn204.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.functions;
-import com.google.common.base.Function;
-import org.jclouds.http.HttpResponse;
-
-import javax.inject.Singleton;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-/**
- * Parses an http response code from http responser
- */
-@Singleton
-public class FalseOn204 implements Function<HttpResponse, Boolean> {
- public Boolean apply(final HttpResponse from) {
- releasePayload(from);
- final int statusCode = from.getStatusCode();
- if (statusCode == 200 || statusCode == 202) {
- return true;
- }
- if (statusCode == 204) {
- return false;
- }
- throw new IllegalStateException("not expected response from: " + from);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/ParseJobStatus.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/ParseJobStatus.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/ParseJobStatus.java
deleted file mode 100644
index 045431c..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/ParseJobStatus.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.functions;
-import com.google.common.base.Function;
-import org.jclouds.azurecompute.arm.util.GetEnumValue;
-import org.jclouds.http.HttpResponse;
-
-import javax.inject.Singleton;
-/**
- * Parses job status from http response
- */
-@Singleton
-public class ParseJobStatus implements Function<HttpResponse, ParseJobStatus.JobStatus> {
- public enum JobStatus {
-
- DONE,
- IN_PROGRESS,
- FAILED,
- NO_CONTENT,
- UNRECOGNIZED;
-
- public static JobStatus fromValue(final String text) {
- return (JobStatus) GetEnumValue.fromValueOrDefault(text, JobStatus.UNRECOGNIZED);
- }
- }
- public JobStatus apply(final HttpResponse from) {
- if (from.getStatusCode() == 202 ){
- return JobStatus.IN_PROGRESS;
- } else if (from.getStatusCode() == 204) {
- return JobStatus.NO_CONTENT;
- } else if (from.getStatusCode() == 200 ){
- return JobStatus.DONE;
- } else {
- return JobStatus.FAILED;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/StatusCodeParser.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/StatusCodeParser.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/StatusCodeParser.java
deleted file mode 100644
index 4c14ec2..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/StatusCodeParser.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.functions;
-import com.google.common.base.Function;
-import org.jclouds.http.HttpResponse;
-
-import javax.inject.Singleton;
-
-import static org.jclouds.http.HttpUtils.releasePayload;
-
-/**
- * Parses an http response code from http responser
- */
-@Singleton
-public class StatusCodeParser implements Function<HttpResponse, String> {
- public String apply(final HttpResponse from) {
- releasePayload(from);
- final String statusCode = Integer.toString(from.getStatusCode());
- if (statusCode != null) {
- return statusCode;
- }
- throw new IllegalStateException("did not receive RequestId in: " + from);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/URIParser.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/URIParser.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/URIParser.java
deleted file mode 100644
index f67e7e2..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/functions/URIParser.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.functions;
-import java.net.URI;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpResponse;
-
-import com.google.common.base.Function;
-/**
- * Parses job status from http response
- */
-@Singleton
-public class URIParser implements Function<HttpResponse, URI> {
- public URI apply(final HttpResponse from) {
- if (from.getStatusCode() == 202 && from.getHeaders().containsKey("Location")){
- String uri = from.getFirstHeaderOrNull("Location");
- return URI.create(uri);
-
- } else if (from.getStatusCode() == 200 || from.getStatusCode() == 204){
- return null;
- }
- throw new IllegalStateException("did not receive expected response code and header in: " + from);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureComputeErrorHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureComputeErrorHandler.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureComputeErrorHandler.java
deleted file mode 100644
index 8492d51..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureComputeErrorHandler.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.handlers;
-
-import java.io.IOException;
-
-import javax.inject.Singleton;
-
-import org.jclouds.azurecompute.arm.exceptions.AzureComputeRateLimitExceededException;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpErrorHandler;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpResponseException;
-import org.jclouds.rest.AuthorizationException;
-import org.jclouds.rest.ResourceNotFoundException;
-import org.jclouds.util.Closeables2;
-import org.jclouds.util.Strings2;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-@Singleton
-public class AzureComputeErrorHandler implements HttpErrorHandler {
-
- @Override
- public void handleError(final HttpCommand command, final HttpResponse response) {
- // it is important to always read fully and close streams
- String message = parseMessage(response);
- Exception exception = message == null
- ? new HttpResponseException(command, response)
- : new HttpResponseException(command, response, message);
- try {
- message = message == null
- ? String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), response.getStatusLine())
- : message;
- switch (response.getStatusCode()) {
- case 400:
- if (message.contains("unauthorized_client")) {
- exception = new AuthorizationException(message, exception);
- }
- else {
- exception = new IllegalArgumentException(message, exception);
- }
- break;
- case 401:
- case 403:
- exception = new AuthorizationException(message, exception);
- break;
-
- case 404:
- if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
- exception = new ResourceNotFoundException(message, exception);
- }
- break;
- case 409:
- exception = new IllegalStateException(message, exception);
- break;
- case 429:
- exception = new AzureComputeRateLimitExceededException(response, exception);
- break;
- default:
- }
- } finally {
- Closeables2.closeQuietly(response.getPayload());
- command.setException(exception);
- }
- }
-
- public String parseMessage(final HttpResponse response) {
- if (response.getPayload() == null) {
- return null;
- }
- try {
- return Strings2.toStringAndClose(response.getPayload().openStream());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureRateLimitRetryHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureRateLimitRetryHandler.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureRateLimitRetryHandler.java
deleted file mode 100644
index ee5f5e5..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/handlers/AzureRateLimitRetryHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.handlers;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.handlers.RateLimitRetryHandler;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Optional;
-import com.google.common.net.HttpHeaders;
-
-@Beta
-@Singleton
-public class AzureRateLimitRetryHandler extends RateLimitRetryHandler {
-
- @Override
- protected Optional<Long> millisToNextAvailableRequest(HttpCommand command, HttpResponse response) {
- String secondsToNextAvailableRequest = response.getFirstHeaderOrNull(HttpHeaders.RETRY_AFTER);
- return secondsToNextAvailableRequest != null ? Optional.of(Long.valueOf(secondsToNextAvailableRequest) * 1000)
- : Optional.<Long> absent();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/GetEnumValue.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/GetEnumValue.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/GetEnumValue.java
deleted file mode 100644
index f42bad3..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/GetEnumValue.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.util;
-
-import java.util.EnumSet;
-
-public class GetEnumValue {
-
- public static <T extends Enum<T>> Enum<T> fromValueOrDefault(String text, Enum<T> defaultValue) {
- if (text != null) {
- EnumSet<T> elements = EnumSet.allOf(defaultValue.getDeclaringClass());
- for (Enum<T> element : elements) {
- if (text.equalsIgnoreCase(element.name())) {
- return element;
- }
- }
- }
- return defaultValue;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/VMImages.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/VMImages.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/VMImages.java
deleted file mode 100644
index 238832e..0000000
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/util/VMImages.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.util;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-public class VMImages {
-
- public static boolean isCustom(String imageId) {
- return checkNotNull(imageId, "id").split("/").length == 3;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadataTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadataTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadataTest.java
deleted file mode 100644
index 2003f9a..0000000
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/AzureComputeProviderMetadataTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm;
-
-import org.jclouds.providers.internal.BaseProviderMetadataTest;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", testName = "AzureManagementProviderMetadataTest")
-public class AzureComputeProviderMetadataTest extends BaseProviderMetadataTest {
-
- public AzureComputeProviderMetadataTest() {
- super(new AzureComputeProviderMetadata(), new AzureManagementApiMetadata());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceLiveTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceLiveTest.java
deleted file mode 100644
index 46f4ed4..0000000
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceLiveTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.compute;
-
-import static org.jclouds.azurecompute.arm.compute.options.AzureTemplateOptions.Builder.resourceGroup;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.jclouds.azurecompute.arm.AzureComputeApi;
-import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
-import org.jclouds.azurecompute.arm.internal.AzureLiveTestUtils;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
-import org.jclouds.logging.config.LoggingModule;
-import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.domain.Statements;
-import org.jclouds.scriptbuilder.statements.java.InstallJDK;
-import org.jclouds.scriptbuilder.statements.login.AdminAccess;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-/**
- * Live tests for the {@link org.jclouds.compute.ComputeService} integration.
- */
-@Test(groups = "live", singleThreaded = true, testName = "AzureComputeServiceLiveTest")
-public class AzureComputeServiceLiveTest extends BaseComputeServiceLiveTest {
-
- private Predicate<URI> resourceDeleted;
- private String resourceGroupName;
-
- public AzureComputeServiceLiveTest() {
- provider = "azurecompute-arm";
- resourceGroupName = getClass().getSimpleName().toLowerCase();
- }
-
- @Override
- public void initializeContext() {
- super.initializeContext();
- resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
- }, Names.named(TIMEOUT_RESOURCE_DELETED)));
- }
-
- @Override
- @AfterClass(groups = "live", alwaysRun = true)
- protected void tearDownContext() {
- try {
- URI uri = view.unwrapApi(AzureComputeApi.class).getResourceGroupApi().delete(resourceGroupName);
- if (uri != null) {
- assertTrue(resourceDeleted.apply(uri),
- String.format("Resource %s was not terminated in the configured timeout", uri));
- }
- } finally {
- super.tearDownContext();
- }
- }
-
- @Override
- protected LoggingModule getLoggingModule() {
- return new SLF4JLoggingModule();
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AzureComputeProviderMetadata.builder().build();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties properties = super.setupProperties();
- AzureLiveTestUtils.defaultProperties(properties);
- setIfTestSystemPropertyPresent(properties, "oauth.endpoint");
- return properties;
- }
-
- @Override
- protected TemplateBuilder templateBuilder() {
- return super.templateBuilder().options(
- resourceGroup(resourceGroupName).authorizePublicKey(keyPair.get("public")).overrideLoginPrivateKey(
- keyPair.get("private")));
- }
-
- @Override
- protected Template addRunScriptToTemplate(Template template) {
- template.getOptions().runScript(
- Statements.newStatementList(new Statement[] { AdminAccess.standard(), Statements.exec("sleep 50"),
- InstallJDK.fromOpenJDK() }));
- return template;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureTemplateBuilderLiveTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureTemplateBuilderLiveTest.java
deleted file mode 100644
index b00aa05..0000000
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/AzureTemplateBuilderLiveTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.compute;
-
-import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.Properties;
-import java.util.Set;
-
-import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
-import org.jclouds.azurecompute.arm.domain.Region;
-import org.jclouds.azurecompute.arm.internal.AzureLiveTestUtils;
-import org.jclouds.compute.domain.OsFamily;
-import org.jclouds.compute.domain.Template;
-import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.Module;
-
-@Test(groups = "live", testName = "AzureTemplateBuilderLiveTest")
-public class AzureTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
-
- public AzureTemplateBuilderLiveTest() {
- provider = "azurecompute-arm";
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AzureComputeProviderMetadata.builder().build();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties properties = super.setupProperties();
- AzureLiveTestUtils.defaultProperties(properties);
- setIfTestSystemPropertyPresent(properties, "oauth.endpoint");
- return properties;
- }
-
- @Override
- @Test
- public void testDefaultTemplateBuilder() throws IOException {
- Template defaultTemplate = view.getComputeService().templateBuilder().build();
- assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[456]\\.[01][04](\\.[0-9])?-LTS"),
- "Version mismatch, expected dd.dd(.d)?-LTS, found: "
- + defaultTemplate.getImage().getOperatingSystem().getVersion());
- assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
- assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
- assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
- }
-
- @Override
- protected Set<String> getIso3166Codes() {
- return Region.iso3166Codes();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/ac03bac4/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeImageExtensionLiveTest.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeImageExtensionLiveTest.java b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeImageExtensionLiveTest.java
deleted file mode 100644
index 885269d..0000000
--- a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/compute/extensions/AzureComputeImageExtensionLiveTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.jclouds.azurecompute.arm.compute.extensions;
-
-import static org.jclouds.azurecompute.arm.compute.options.AzureTemplateOptions.Builder.resourceGroup;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.TIMEOUT_RESOURCE_DELETED;
-import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jclouds.azurecompute.arm.AzureComputeApi;
-import org.jclouds.azurecompute.arm.AzureComputeProviderMetadata;
-import org.jclouds.azurecompute.arm.internal.AzureLiveTestUtils;
-import org.jclouds.compute.ComputeTestUtils;
-import org.jclouds.compute.domain.ExecResponse;
-import org.jclouds.compute.domain.NodeMetadata;
-import org.jclouds.compute.domain.TemplateBuilder;
-import org.jclouds.compute.extensions.internal.BaseImageExtensionLiveTest;
-import org.jclouds.domain.Location;
-import org.jclouds.providers.ProviderMetadata;
-import org.jclouds.sshj.config.SshjSshClientModule;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Predicate;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-/**
- * Live tests for the {@link org.jclouds.compute.extensions.ImageExtension}
- * integration.
- */
-@Test(groups = "live", singleThreaded = true, testName = "AzureComputeImageExtensionLiveTest")
-public class AzureComputeImageExtensionLiveTest extends BaseImageExtensionLiveTest {
-
- private Predicate<URI> resourceDeleted;
- private String resourceGroupName;
-
- public AzureComputeImageExtensionLiveTest() {
- provider = "azurecompute-arm";
- resourceGroupName = getClass().getSimpleName().toLowerCase();
- }
-
- @BeforeClass(groups = { "integration", "live" })
- public void setupContext() {
- super.setupContext();
- resourceDeleted = context.utils().injector().getInstance(Key.get(new TypeLiteral<Predicate<URI>>() {
- }, Names.named(TIMEOUT_RESOURCE_DELETED)));
- createResourceGroup(resourceGroupName);
- }
-
- @AfterClass(groups = { "integration", "live" })
- @Override
- protected void tearDownContext() {
- try {
- URI uri = view.unwrapApi(AzureComputeApi.class).getResourceGroupApi().delete(resourceGroupName);
- if (uri != null) {
- assertTrue(resourceDeleted.apply(uri),
- String.format("Resource %s was not terminated in the configured timeout", uri));
- }
- } finally {
- super.tearDownContext();
- }
- }
-
- @Override
- protected void prepareNodeBeforeCreatingImage(NodeMetadata node) {
- // Don't wrap in the init-script, since the comand will clear the user
- // config, and jclouds won't be able to execute more than one command
- // (won't be able to poll for the execution status of the command when
- // running with the init-script)
- ExecResponse result = view.getComputeService().runScriptOnNode(node.getId(), "waagent -deprovision+user -force",
- wrapInInitScript(false));
- assertEquals(result.getExitStatus(), 0);
- }
-
- @Override
- protected Module getSshModule() {
- return new SshjSshClientModule();
- }
-
- @Override
- protected Properties setupProperties() {
- Properties properties = super.setupProperties();
- AzureLiveTestUtils.defaultProperties(properties);
- setIfTestSystemPropertyPresent(properties, "oauth.endpoint");
- return properties;
- }
-
- @Override
- protected ProviderMetadata createProviderMetadata() {
- return AzureComputeProviderMetadata.builder().build();
- }
-
- @Override
- public TemplateBuilder getNodeTemplate() {
- Map<String, String> keyPair = ComputeTestUtils.setupKeyPair();
- return super.getNodeTemplate().options(
- resourceGroup(resourceGroupName).authorizePublicKey(keyPair.get("public")).overrideLoginPrivateKey(
- keyPair.get("private")));
- }
-
- private void createResourceGroup(String name) {
- Location location = getNodeTemplate().build().getLocation();
- view.unwrapApi(AzureComputeApi.class).getResourceGroupApi().create(name, location.getId(), null);
- }
-}