Search in sources :

Example 56 with Response

use of com.yahoo.vespa.clustercontroller.core.restapiv2.Response in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method createKeyWithServiceResponseAsync.

/**
     * Creates a new key, stores it, then returns key parameters and attributes to the client. The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. Authorization: Requires the keys/create permission.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param keyName The name for the new key. The system will generate the version name for the new key.
     * @param kty The type of key to create. For valid key types, see JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', 'RSA-HSM', 'oct'
     * @return the observable to the KeyBundle object
     */
public Observable<ServiceResponse<KeyBundle>> createKeyWithServiceResponseAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (keyName == null) {
        throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    if (kty == null) {
        throw new IllegalArgumentException("Parameter kty is required and cannot be null.");
    }
    final Integer keySize = null;
    final List<JsonWebKeyOperation> keyOps = null;
    final KeyAttributes keyAttributes = null;
    final Map<String, String> tags = null;
    KeyCreateParameters parameters = new KeyCreateParameters();
    parameters.withKty(kty);
    parameters.withKeySize(null);
    parameters.withKeyOps(null);
    parameters.withKeyAttributes(null);
    parameters.withTags(null);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.createKey(keyName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyBundle>>>() {

        @Override
        public Observable<ServiceResponse<KeyBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<KeyBundle> clientResponse = createKeyDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : KeyAttributes(com.microsoft.azure.keyvault.models.KeyAttributes) KeyCreateParameters(com.microsoft.azure.keyvault.models.KeyCreateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) JsonWebKeyOperation(com.microsoft.azure.keyvault.webkey.JsonWebKeyOperation) KeyBundle(com.microsoft.azure.keyvault.models.KeyBundle)

Example 57 with Response

use of com.yahoo.vespa.clustercontroller.core.restapiv2.Response in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method importCertificateWithServiceResponseAsync.

/**
     * Imports a certificate into a specified key vault.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param certificateName The name of the certificate.
     * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key.
     * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption.
     * @param certificatePolicy The management policy for the certificate.
     * @param certificateAttributes The attributes of the certificate (optional).
     * @param tags Application specific metadata in the form of key-value pairs.
     * @return the observable to the CertificateBundle object
     */
public Observable<ServiceResponse<CertificateBundle>> importCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (certificateName == null) {
        throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    if (base64EncodedCertificate == null) {
        throw new IllegalArgumentException("Parameter base64EncodedCertificate is required and cannot be null.");
    }
    Validator.validate(certificatePolicy);
    Validator.validate(certificateAttributes);
    Validator.validate(tags);
    CertificateImportParameters parameters = new CertificateImportParameters();
    parameters.withBase64EncodedCertificate(base64EncodedCertificate);
    parameters.withPassword(password);
    parameters.withCertificatePolicy(certificatePolicy);
    parameters.withCertificateAttributes(certificateAttributes);
    parameters.withTags(tags);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.importCertificate(certificateName, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateBundle>>>() {

        @Override
        public Observable<ServiceResponse<CertificateBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CertificateBundle> clientResponse = importCertificateDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) CertificateBundle(com.microsoft.azure.keyvault.models.CertificateBundle) CertificateImportParameters(com.microsoft.azure.keyvault.models.CertificateImportParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 58 with Response

use of com.yahoo.vespa.clustercontroller.core.restapiv2.Response in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateKeyWithServiceResponseAsync.

/**
     * The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. The cryptographic material of a key itself cannot be changed. In order to perform this operation, the key must already exist in the Key Vault. Authorization: requires the keys/update permission.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param keyName The name of key to update.
     * @param keyVersion The version of the key to update.
     * @return the observable to the KeyBundle object
     */
public Observable<ServiceResponse<KeyBundle>> updateKeyWithServiceResponseAsync(String vaultBaseUrl, String keyName, String keyVersion) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (keyName == null) {
        throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
    }
    if (keyVersion == null) {
        throw new IllegalArgumentException("Parameter keyVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    final List<JsonWebKeyOperation> keyOps = null;
    final KeyAttributes keyAttributes = null;
    final Map<String, String> tags = null;
    KeyUpdateParameters parameters = new KeyUpdateParameters();
    parameters.withKeyOps(null);
    parameters.withKeyAttributes(null);
    parameters.withTags(null);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateKey(keyName, keyVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<KeyBundle>>>() {

        @Override
        public Observable<ServiceResponse<KeyBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<KeyBundle> clientResponse = updateKeyDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : KeyAttributes(com.microsoft.azure.keyvault.models.KeyAttributes) KeyUpdateParameters(com.microsoft.azure.keyvault.models.KeyUpdateParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) JsonWebKeyOperation(com.microsoft.azure.keyvault.webkey.JsonWebKeyOperation) KeyBundle(com.microsoft.azure.keyvault.models.KeyBundle)

Example 59 with Response

use of com.yahoo.vespa.clustercontroller.core.restapiv2.Response in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateCertificateWithServiceResponseAsync.

/**
     * Updates the specified attributes associated with the given certificate.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param certificateName The name of the certificate in the given key vault.
     * @param certificateVersion The version of the certificate.
     * @param certificatePolicy The management policy for the certificate.
     * @param certificateAttributes The attributes of the certificate (optional).
     * @param tags Application specific metadata in the form of key-value pairs.
     * @return the observable to the CertificateBundle object
     */
public Observable<ServiceResponse<CertificateBundle>> updateCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (certificateName == null) {
        throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
    }
    if (certificateVersion == null) {
        throw new IllegalArgumentException("Parameter certificateVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    Validator.validate(certificatePolicy);
    Validator.validate(certificateAttributes);
    Validator.validate(tags);
    CertificateUpdateParameters parameters = new CertificateUpdateParameters();
    parameters.withCertificatePolicy(certificatePolicy);
    parameters.withCertificateAttributes(certificateAttributes);
    parameters.withTags(tags);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateCertificate(certificateName, certificateVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateBundle>>>() {

        @Override
        public Observable<ServiceResponse<CertificateBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CertificateBundle> clientResponse = updateCertificateDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) CertificateBundle(com.microsoft.azure.keyvault.models.CertificateBundle) Observable(rx.Observable) CertificateUpdateParameters(com.microsoft.azure.keyvault.models.CertificateUpdateParameters) ResponseBody(okhttp3.ResponseBody)

Example 60 with Response

use of com.yahoo.vespa.clustercontroller.core.restapiv2.Response in project azure-sdk-for-java by Azure.

the class WebAppsInner method listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync.

/**
     * Gets the publishing profile for an app (or deployment slot, if specified).
     * Gets the publishing profile for an app (or deployment slot, if specified).
     *
     * @param resourceGroupName Name of the resource group to which the resource belongs.
     * @param name Name of the app.
     * @param slot Name of the deployment slot. If a slot is not specified, the API will get the publishing profile for the production slot.
     * @param format Name of the format. Valid values are:
      FileZilla3
      WebDeploy -- default
      Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the InputStream object
     */
public Observable<ServiceResponse<InputStream>> listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync(String resourceGroupName, String name, String slot, PublishingProfileFormat format) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (slot == null) {
        throw new IllegalArgumentException("Parameter slot is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2016-08-01";
    CsmPublishingProfileOptions publishingProfileOptions = new CsmPublishingProfileOptions();
    publishingProfileOptions.withFormat(format);
    return service.listPublishingProfileXmlWithSecretsSlot(resourceGroupName, name, slot, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), publishingProfileOptions, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<InputStream>>>() {

        @Override
        public Observable<ServiceResponse<InputStream>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<InputStream> clientResponse = listPublishingProfileXmlWithSecretsSlotDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) InputStream(java.io.InputStream) Observable(rx.Observable) CsmPublishingProfileOptions(com.microsoft.azure.management.appservice.CsmPublishingProfileOptions) ResponseBody(okhttp3.ResponseBody)

Aggregations

Response (okhttp3.Response)1083 Request (okhttp3.Request)814 IOException (java.io.IOException)434 Test (org.junit.Test)330 Response (retrofit2.Response)319 Call (okhttp3.Call)236 ResponseBody (okhttp3.ResponseBody)208 OkHttpClient (okhttp3.OkHttpClient)192 ServiceResponse (com.microsoft.rest.ServiceResponse)179 RequestBody (okhttp3.RequestBody)128 Observable (rx.Observable)116 Callback (okhttp3.Callback)111 MockResponse (okhttp3.mockwebserver.MockResponse)93 List (java.util.List)89 HttpUrl (okhttp3.HttpUrl)81 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)72 TypeToken (com.google.common.reflect.TypeToken)71 ArrayList (java.util.ArrayList)71 File (java.io.File)70 JSONObject (org.json.JSONObject)65