Skip to content

Commit

Permalink
Merge pull request #146 from perfectsense/feature/provider-sdk-updates
Browse files Browse the repository at this point in the history
Utilize new java sdk bom
  • Loading branch information
deepanjan90 authored Jul 25, 2024
2 parents f146b6b + 45ab73d commit 23e5653
Show file tree
Hide file tree
Showing 17 changed files with 250 additions and 162 deletions.
20 changes: 11 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ dependencies {
implementation 'com.psddev:dari-util:3.3.607-xe0f27a'
implementation 'com.google.guava:guava:31.1-jre'

implementation 'com.azure.resourcemanager:azure-resourcemanager:2.15.0'
implementation 'com.azure:azure-security-keyvault-certificates:4.3.2'
implementation 'com.azure:azure-data-tables:12.3.0'
implementation 'com.azure:azure-storage-queue:12.12.2'
implementation 'com.azure:azure-storage-file-share:12.12.2'
implementation 'com.azure:azure-storage-blob:12.16.1'
implementation 'com.azure:azure-security-keyvault-certificates:4.3.2'
implementation 'com.azure:azure-identity:1.5.1'
implementation 'com.azure:azure-core-http-okhttp:1.9.0'
implementation enforcedPlatform('com.azure:azure-sdk-bom:1.2.25')
implementation 'com.azure.resourcemanager:azure-resourcemanager:2.40.0'
implementation 'com.azure:azure-security-keyvault-certificates'
implementation 'com.azure:azure-security-keyvault-keys'
implementation 'com.azure:azure-security-keyvault-secrets'
implementation 'com.azure:azure-data-tables'
implementation 'com.azure:azure-storage-queue'
implementation 'com.azure:azure-storage-file-share'
implementation 'com.azure:azure-storage-blob'
implementation 'com.azure:azure-identity'
implementation 'com.azure:azure-core-http-okhttp'
runtimeOnly 'com.nimbusds:oauth2-oidc-sdk:9.35'

gyroDoclet 'gyro:gyro-doclet:1.0.0'
Expand Down
1 change: 0 additions & 1 deletion examples/containerservice/kubernetes-cluster.gyro
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ azure::kubernetes-cluster kubernetes-cluster-example

network-profile
dns-service-ip: "10.0.0.10"
docker-bridge-cidr: "172.17.0.1/16"
service-cidr: "10.0.0.0/16"
load-balancer-sku: "Standard"
outbound-type: "loadBalancer"
Expand Down
2 changes: 1 addition & 1 deletion examples/sql/sql.gyro
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ azure::sql-failover-group failover-example
database-ids: [$(azure::sql-database sql-database-example).id]
sql-server: $(azure::sql-server sql-server-example)
manual-read-and-write-policy: false
read-write-grace-period: 2
read-write-grace-period: 60
partner-server-ids: [$(azure::sql-server sql-server-example-partner-server).id]
read-only-policy-enabled: false
end
4 changes: 3 additions & 1 deletion src/main/java/gyro/azure/cdn/CdnProfileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void setResourceGroup(ResourceGroupResource resourceGroup) {
* The sku of the CDN Profile.
*/
@Required
@ValidStrings({ "Premium_Verizon", "Standard_Verizon", "Standard_Akamai" })
@ValidStrings({"Premium_Verizon", "Standard_Verizon", "Standard_Akamai", "Standard_Microsoft"})
public String getSku() {
return sku;
}
Expand Down Expand Up @@ -193,6 +193,8 @@ public void create(GyroUI ui, State state) {
cdnProfile = withSku.withStandardVerizonSku().withTags(getTags()).create();
} else if ("Standard_Akamai".equalsIgnoreCase(getSku())) {
cdnProfile = withSku.withStandardAkamaiSku().withTags(getTags()).create();
} else if ("Standard_Microsoft".equalsIgnoreCase(getSku())) {
cdnProfile = withSku.withStandardMicrosoftSku().withTags(getTags()).create();
}

copyFrom(cdnProfile);
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/gyro/azure/compute/VirtualMachineResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ public void copyFrom(VirtualMachine virtualMachine) {
PublicIpAddressResource.class,
virtualMachine.getPrimaryPublicIPAddressId()) : null);
setOsType(virtualMachine.osType().name());
setStorageAccountTypeOsDisk(virtualMachine.osDiskStorageAccountType().toString());

setNetworkInterface(
findById(
Expand Down Expand Up @@ -737,7 +738,8 @@ public void copyFrom(VirtualMachine virtualMachine) {

setDataDisks(dataDisks);

setEnableSystemManagedServiceIdentity(!ObjectUtils.isBlank(virtualMachine.systemAssignedManagedServiceIdentityPrincipalId()));
setEnableSystemManagedServiceIdentity(
!ObjectUtils.isBlank(virtualMachine.systemAssignedManagedServiceIdentityPrincipalId()));
setSystemManagedServiceIdentityPrincipalId(virtualMachine.systemAssignedManagedServiceIdentityPrincipalId());

getIdentities().clear();
Expand Down Expand Up @@ -828,8 +830,9 @@ private WithCreate doVMFluentWorkflow(AzureResourceManager client) {
}

for (IdentityResource identity : getIdentities()) {
osConfiguredVMBuilder = osConfiguredVMBuilder.withExistingUserAssignedManagedServiceIdentity(client.identities()
.getById(identity.getId()));
osConfiguredVMBuilder =
osConfiguredVMBuilder.withExistingUserAssignedManagedServiceIdentity(client.identities()
.getById(identity.getId()));
}

return osConfiguredVMBuilder
Expand Down Expand Up @@ -1017,7 +1020,8 @@ private WithFromImageCreateOptionsManaged configureLinuxAdmin(WithLinuxRootUsern
* Fourth step in Virtual Machine Fluent workflow. Configures Admin User for ManagedOrUnmanaged Disk types
* @return {@link WithFromImageCreateOptionsManagedOrUnmanaged} VM Definition object ready for data disk configurations
*/
private WithFromImageCreateOptionsManagedOrUnmanaged configureLinuxAdmin(WithLinuxRootUsernameManagedOrUnmanaged vmImageTypeConfigured) {
private WithFromImageCreateOptionsManagedOrUnmanaged configureLinuxAdmin(
WithLinuxRootUsernameManagedOrUnmanaged vmImageTypeConfigured) {
WithLinuxCreateManagedOrUnmanaged adminConfigured = null;
WithLinuxRootPasswordOrPublicKeyManagedOrUnmanaged rootUserConfigured = vmImageTypeConfigured.withRootUsername(
getAdminUserName());
Expand All @@ -1040,7 +1044,8 @@ private WithFromImageCreateOptionsManagedOrUnmanaged configureLinuxAdmin(WithLin
* Fourth step in Virtual Machine Fluent workflow. Configures Admin User for Unmanaged Disk types
* @return {@link WithFromImageCreateOptionsUnmanaged} VM Definition object ready for data disk configurations
*/
private WithFromImageCreateOptionsUnmanaged configureLinuxAdmin(WithLinuxRootUsernameUnmanaged vmImageTypeConfigured) {
private WithFromImageCreateOptionsUnmanaged configureLinuxAdmin(
WithLinuxRootUsernameUnmanaged vmImageTypeConfigured) {
WithLinuxCreateUnmanaged adminConfigured = null;
WithLinuxRootPasswordOrPublicKeyUnmanaged rootUserConfigured = vmImageTypeConfigured.withRootUsername(
getAdminUserName());
Expand Down Expand Up @@ -1168,7 +1173,8 @@ private WithWindowsCreateManaged configureWindowsAdmin(WithWindowsAdminUsernameM
* Fourth step in Virtual Machine Fluent workflow. Configures Admin User for ManagedOrUnmanaged Disk types
* @return {@link WithWindowsCreateManagedOrUnmanaged} VM Definition object ready for data disk configurations
*/
private WithWindowsCreateManagedOrUnmanaged configureWindowsAdmin(WithWindowsAdminUsernameManagedOrUnmanaged vmImageTypeConfigured) {
private WithWindowsCreateManagedOrUnmanaged configureWindowsAdmin(
WithWindowsAdminUsernameManagedOrUnmanaged vmImageTypeConfigured) {
return vmImageTypeConfigured.withAdminUsername(getAdminUserName())
.withAdminPassword(getAdminPassword());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
*
* network-profile
* dns-service-ip: "10.0.0.10"
* docker-bridge-cidr: "172.17.0.1/16"
* service-cidr: "10.0.0.0/16"
* load-balancer-sku: "Standard"
* outbound-type: "loadBalancer"
Expand Down Expand Up @@ -592,9 +591,6 @@ public void create(GyroUI ui, State state) throws Exception {
if (!StringUtils.isBlank(network.getPodCidr())) {
withAttach = withAttach.withPodCidr(network.getPodCidr());
}
if (!StringUtils.isBlank(network.getDockerBridgeCidr())) {
withAttach = withAttach.withDockerBridgeCidr(network.getDockerBridgeCidr());
}

if (!StringUtils.isBlank(network.getServiceCidr())) {
withAttach = withAttach.withServiceCidr(network.getServiceCidr());
Expand Down
18 changes: 0 additions & 18 deletions src/main/java/gyro/azure/containerservice/NetworkProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
public class NetworkProfile extends Diffable implements Copyable<ContainerServiceNetworkProfile> {

private String dnsServiceIp;
private String dockerBridgeCidr;
private String networkPlugin;
private String networkMode;
private String networkPolicy;
Expand All @@ -55,18 +54,6 @@ public void setDnsServiceIp(String dnsServiceIp) {
this.dnsServiceIp = dnsServiceIp;
}

/**
* The docker bridge cidr for the network profile.
*/
@Updatable
public String getDockerBridgeCidr() {
return dockerBridgeCidr;
}

public void setDockerBridgeCidr(String dockerBridgeCidr) {
this.dockerBridgeCidr = dockerBridgeCidr;
}

/**
* The network plugin for the network profile.
*/
Expand Down Expand Up @@ -187,7 +174,6 @@ public void setServiceCidr(String serviceCidr) {
@Override
public void copyFrom(ContainerServiceNetworkProfile model) {
setDnsServiceIp(model.dnsServiceIp());
setDockerBridgeCidr(model.dockerBridgeCidr());
setNetworkPlugin(model.networkPlugin().toString());
setNetworkMode(model.networkMode() != null ? model.networkMode().toString() : null);
setNetworkPolicy(model.networkPolicy() != null ? model.networkPolicy().toString() : null);
Expand Down Expand Up @@ -243,10 +229,6 @@ protected ContainerServiceNetworkProfile toNetworkProfile() {
networkProfile.withOutboundType(OutboundType.fromString(getOutboundType()));
}

if (!StringUtils.isBlank(getDockerBridgeCidr())) {
networkProfile.withDockerBridgeCidr(getDockerBridgeCidr());
}

if (!StringUtils.isBlank(getServiceCidr())) {
networkProfile.withServiceCidr(getServiceCidr());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void setSubject(String subject) {
/**
* The key type.
*/
@ValidStrings({"RSA", "RSA-HSM", "EC", "EC-HSM"})
// @ValidStrings({"RSA", "RSA-HSM", "EC", "EC-HSM"})
public String getKeyType() {
return keyType;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ public void setValidityInMonths(Integer validityInMonths) {
/**
* The key size.
*/
@ValidNumbers({2048, 3072, 4096})
@ValidNumbers({256, 384, 521})
public Integer getKeySize() {
return keySize;
}
Expand Down Expand Up @@ -332,7 +332,7 @@ public void copyFrom(CertificatePolicy certificatePolicy) {

@Override
public String primaryKey() {
return "";
return "policy";
}

CertificatePolicy toCertificatePolicy() {
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/gyro/azure/keyvault/KeyVaultKeyAttribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.time.OffsetDateTime;

import com.azure.security.keyvault.keys.models.CreateEcKeyOptions;
import com.azure.security.keyvault.keys.models.CreateKeyOptions;
import com.azure.security.keyvault.keys.models.KeyProperties;
import gyro.azure.Copyable;
import gyro.core.resource.Diffable;
Expand Down Expand Up @@ -91,11 +93,4 @@ public void copyFrom(KeyProperties properties) {
setCreated(properties.getCreatedOn() != null ? properties.getCreatedOn().toString() : null);
setUpdated(properties.getUpdatedOn() != null ? properties.getUpdatedOn().toString() : null);
}

KeyProperties toKeyProperties() {
return new KeyProperties()
.setEnabled(getEnabled())
.setExpiresOn(getExpires() != null ? OffsetDateTime.parse(getExpires()) : null)
.setNotBefore(getNotBefore() != null ? OffsetDateTime.parse(getNotBefore()) : null);
}
}
Loading

0 comments on commit 23e5653

Please sign in to comment.