com.azure.resourcemanager.network.implementation.ApplicationGatewaySslCertificateImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-network Show documentation
Show all versions of azure-resourcemanager-network Show documentation
This package contains Microsoft Azure Network Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.network.implementation;
import com.azure.resourcemanager.network.models.ApplicationGateway;
import com.azure.resourcemanager.network.models.ApplicationGatewaySslCertificate;
import com.azure.resourcemanager.network.fluent.models.ApplicationGatewaySslCertificateInner;
import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.ChildResourceImpl;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Base64;
/** Implementation for ApplicationGatewaySslCertificate. */
class ApplicationGatewaySslCertificateImpl
extends ChildResourceImpl
implements ApplicationGatewaySslCertificate,
ApplicationGatewaySslCertificate.Definition,
ApplicationGatewaySslCertificate.UpdateDefinition,
ApplicationGatewaySslCertificate.Update {
ApplicationGatewaySslCertificateImpl(ApplicationGatewaySslCertificateInner inner, ApplicationGatewayImpl parent) {
super(inner, parent);
}
// Helpers
// Getters
@Override
public String name() {
return this.innerModel().name();
}
@Override
public String publicData() {
return this.innerModel().publicCertData();
}
@Override
public String keyVaultSecretId() {
return this.innerModel().keyVaultSecretId();
}
// Verbs
@Override
public ApplicationGatewayImpl attach() {
return this.parent().withSslCertificate(this);
}
// Withers
@Override
public ApplicationGatewaySslCertificateImpl withPfxFromBytes(byte[] pfxData) {
String encoded = new String(Base64.getEncoder().encode(pfxData), StandardCharsets.UTF_8);
this.innerModel().withData(encoded);
return this;
}
@Override
public ApplicationGatewaySslCertificateImpl withPfxFromFile(File pfxFile) throws IOException {
if (pfxFile == null) {
return null;
}
byte[] content = Files.readAllBytes(pfxFile.toPath());
return withPfxFromBytes(content);
}
@Override
public ApplicationGatewaySslCertificateImpl withPfxPassword(String password) {
this.innerModel().withPassword(password);
return this;
}
@Override
public ApplicationGatewaySslCertificateImpl withKeyVaultSecretId(String keyVaultSecretId) {
this.innerModel().withKeyVaultSecretId(keyVaultSecretId);
return this;
}
}