From f947536f431315864066f700e3d2c97fe49b5d19 Mon Sep 17 00:00:00 2001 From: Harshil Sanjay Jain Date: Wed, 31 Jul 2024 16:44:42 -0400 Subject: [PATCH 1/2] Update createClient to account for the client class being requested --- src/main/java/gyro/azure/AzureResource.java | 8 -------- .../ActiveDirectoryGroupResource.java | 6 +++--- .../ActiveDirectoryUserResource.java | 6 +++--- .../azure/accessmanagement/ApplicationResource.java | 8 ++++---- .../accessmanagement/RoleAssignmentResource.java | 8 ++++---- .../accessmanagement/ServicePrincipalResource.java | 6 +++--- .../java/gyro/azure/cdn/CdnEndpointResource.java | 6 +++--- src/main/java/gyro/azure/cdn/CdnProfileResource.java | 8 ++++---- .../gyro/azure/compute/AvailabilitySetResource.java | 8 ++++---- src/main/java/gyro/azure/compute/DiskResource.java | 8 ++++---- .../java/gyro/azure/compute/SnapshotResource.java | 8 ++++---- .../java/gyro/azure/compute/VMScaleSetResource.java | 10 +++++----- .../azure/compute/VMScaleSetScalingResource.java | 8 ++++---- .../azure/compute/VirtualMachineImageResource.java | 6 +++--- .../gyro/azure/compute/VirtualMachineResource.java | 10 +++++----- .../containerservice/KubernetesClusterResource.java | 8 ++++---- .../gyro/azure/cosmosdb/CosmosDBAccountResource.java | 8 ++++---- src/main/java/gyro/azure/dns/ARecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/AaaaRecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/CaaRecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/CnameRecordSetResource.java | 8 ++++---- src/main/java/gyro/azure/dns/DnsZoneResource.java | 8 ++++---- .../java/gyro/azure/dns/MxRecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/PtrRecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/SrvRecordSetResource.java | 8 ++++---- .../java/gyro/azure/dns/TxtRecordSetResource.java | 8 ++++---- .../java/gyro/azure/identity/IdentityResource.java | 8 ++++---- .../java/gyro/azure/keyvault/KeyVaultResource.java | 10 +++++----- .../azure/network/ApplicationGatewayResource.java | 10 +++++----- .../network/ApplicationSecurityGroupResource.java | 8 ++++---- .../gyro/azure/network/LoadBalancerResource.java | 8 ++++---- .../gyro/azure/network/NetworkInterfaceResource.java | 8 ++++---- .../java/gyro/azure/network/NetworkResource.java | 8 ++++---- .../azure/network/NetworkSecurityGroupResource.java | 8 ++++---- .../network/NetworkSecurityGroupRuleResource.java | 6 +++--- .../azure/network/NicIpConfigurationResource.java | 6 +++--- .../gyro/azure/network/PublicIpAddressResource.java | 8 ++++---- .../java/gyro/azure/network/RouteTableResource.java | 8 ++++---- src/main/java/gyro/azure/network/SubnetResource.java | 6 +++--- .../java/gyro/azure/registries/RegistryResource.java | 8 ++++---- .../gyro/azure/resources/ResourceGroupResource.java | 8 ++++---- .../java/gyro/azure/sql/SqlDatabaseResource.java | 8 ++++---- .../java/gyro/azure/sql/SqlElasticPoolResource.java | 8 ++++---- .../gyro/azure/sql/SqlFailoverGroupResource.java | 8 ++++---- .../java/gyro/azure/sql/SqlFirewallRuleResource.java | 8 ++++---- src/main/java/gyro/azure/sql/SqlServerResource.java | 8 ++++---- .../azure/sql/SqlVirtualNetworkRuleResource.java | 8 ++++---- .../gyro/azure/storage/StorageAccountResource.java | 12 ++++++------ .../java/gyro/azure/storage/StorageLifeCycle.java | 6 +++--- 49 files changed, 189 insertions(+), 197 deletions(-) diff --git a/src/main/java/gyro/azure/AzureResource.java b/src/main/java/gyro/azure/AzureResource.java index d8d64fcf..a1d1b421 100644 --- a/src/main/java/gyro/azure/AzureResource.java +++ b/src/main/java/gyro/azure/AzureResource.java @@ -35,14 +35,6 @@ protected T createClient(Class clientClass) { return AzureResource.createClient(clientClass, credentials(AzureCredentials.class)); } - protected AzureResourceManager createClient() { - return AzureResource.createClient(AzureResourceManager.class, credentials(AzureCredentials.class)); - } - - protected CommunicationManager createCommunicationClient() { - return AzureResource.createClient(CommunicationManager.class, credentials(AzureCredentials.class)); - } - public static TokenCredential getTokenCredential(AzureCredentials credentials) { return credentials.getTokenCredential(); } diff --git a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupResource.java b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupResource.java index 58233f12..26a8698e 100644 --- a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupResource.java +++ b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupResource.java @@ -95,7 +95,7 @@ public void copyFrom(ActiveDirectoryGroup group) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryGroup group = client.accessManagement().activeDirectoryGroups().getById(getId()); @@ -110,7 +110,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryGroup group = client.accessManagement().activeDirectoryGroups() .define(getName()) @@ -127,7 +127,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.accessManagement().activeDirectoryGroups().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserResource.java b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserResource.java index e4aa8957..86c50445 100644 --- a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserResource.java +++ b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserResource.java @@ -141,7 +141,7 @@ public void copyFrom(ActiveDirectoryUser user) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryUser user = client.accessManagement().activeDirectoryUsers().getById(getId()); @@ -156,7 +156,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryUser activeDirectoryUser = client.accessManagement().activeDirectoryUsers() .define(getName()) @@ -175,7 +175,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.accessManagement().activeDirectoryUsers().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/accessmanagement/ApplicationResource.java b/src/main/java/gyro/azure/accessmanagement/ApplicationResource.java index 3476f98c..c2498a6f 100644 --- a/src/main/java/gyro/azure/accessmanagement/ApplicationResource.java +++ b/src/main/java/gyro/azure/accessmanagement/ApplicationResource.java @@ -171,7 +171,7 @@ public void copyFrom(ActiveDirectoryApplication model) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryApplication application = client.accessManagement() .activeDirectoryApplications() @@ -188,7 +188,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryApplication.DefinitionStages.WithCreate withCreate = client.accessManagement() .activeDirectoryApplications() @@ -215,7 +215,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update( GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ActiveDirectoryApplication application = client.accessManagement() .activeDirectoryApplications() @@ -258,7 +258,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.accessManagement().activeDirectoryApplications().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/accessmanagement/RoleAssignmentResource.java b/src/main/java/gyro/azure/accessmanagement/RoleAssignmentResource.java index cc3706b1..e08aeec3 100644 --- a/src/main/java/gyro/azure/accessmanagement/RoleAssignmentResource.java +++ b/src/main/java/gyro/azure/accessmanagement/RoleAssignmentResource.java @@ -152,7 +152,7 @@ public void copyFrom(RoleAssignment roleAssignment) { setScope(roleAssignment.scope()); setId(roleAssignment.id()); - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); setRole(client.accessManagement().roleDefinitions().getById(roleAssignment.roleDefinitionId()).roleName()); ActiveDirectoryUser user = null; @@ -180,7 +180,7 @@ public void copyFrom(RoleAssignment roleAssignment) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); RoleAssignment roleAssignment = client.accessManagement().roleAssignments().getByScope(getScope(), getName()); @@ -195,7 +195,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); if (Stream.of(getPrincipalId(), getUser(), getGroup()).filter(Objects::nonNull).count() > 1) { throw new GyroException("Only one of 'principal-id' or 'user' or 'group' is allowed."); @@ -254,7 +254,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.accessManagement().roleAssignments().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/accessmanagement/ServicePrincipalResource.java b/src/main/java/gyro/azure/accessmanagement/ServicePrincipalResource.java index 941cd166..ac30bc41 100644 --- a/src/main/java/gyro/azure/accessmanagement/ServicePrincipalResource.java +++ b/src/main/java/gyro/azure/accessmanagement/ServicePrincipalResource.java @@ -98,7 +98,7 @@ public void copyFrom(ServicePrincipal model) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ServicePrincipal servicePrincipal = client.accessManagement().servicePrincipals().getByName(getName()); @@ -113,7 +113,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ServicePrincipal servicePrincipal = client.accessManagement().servicePrincipals() .define(getName()) @@ -131,7 +131,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.accessManagement().servicePrincipals().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/cdn/CdnEndpointResource.java b/src/main/java/gyro/azure/cdn/CdnEndpointResource.java index 7b7161bc..95b54772 100644 --- a/src/main/java/gyro/azure/cdn/CdnEndpointResource.java +++ b/src/main/java/gyro/azure/cdn/CdnEndpointResource.java @@ -339,7 +339,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfileResource parent = (CdnProfileResource) parent(); @@ -432,7 +432,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfileResource parent = (CdnProfileResource) parent(); @@ -524,7 +524,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfileResource parent = (CdnProfileResource) parent(); diff --git a/src/main/java/gyro/azure/cdn/CdnProfileResource.java b/src/main/java/gyro/azure/cdn/CdnProfileResource.java index 2aa44830..0bb40cd9 100644 --- a/src/main/java/gyro/azure/cdn/CdnProfileResource.java +++ b/src/main/java/gyro/azure/cdn/CdnProfileResource.java @@ -165,7 +165,7 @@ public void copyFrom(CdnProfile cdnProfile) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfile cdnProfile = client.cdnProfiles().getById(getId()); @@ -180,7 +180,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfile.DefinitionStages.WithSku withSku = client.cdnProfiles().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -202,7 +202,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CdnProfile.Update update = client.cdnProfiles().getById(getId()).update().withTags(getTags()); update.apply(); @@ -210,7 +210,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.cdnProfiles().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/AvailabilitySetResource.java b/src/main/java/gyro/azure/compute/AvailabilitySetResource.java index c2712418..6cbac80f 100644 --- a/src/main/java/gyro/azure/compute/AvailabilitySetResource.java +++ b/src/main/java/gyro/azure/compute/AvailabilitySetResource.java @@ -175,7 +175,7 @@ public void copyFrom(AvailabilitySet availabilitySet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AvailabilitySet availabilitySet = client.availabilitySets().getById(getId()); @@ -190,7 +190,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AvailabilitySet availabilitySet = client.availabilitySets().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -206,7 +206,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); if (changedFieldNames.contains("sku") && AvailabilitySetSkuTypes.fromString(getSku()) .equals(AvailabilitySetSkuTypes.CLASSIC)) { @@ -223,7 +223,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.availabilitySets().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/DiskResource.java b/src/main/java/gyro/azure/compute/DiskResource.java index c40a4a55..72c2e7da 100644 --- a/src/main/java/gyro/azure/compute/DiskResource.java +++ b/src/main/java/gyro/azure/compute/DiskResource.java @@ -221,7 +221,7 @@ public void copyFrom(Disk disk) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Disk disk = client.disks().getById(getId()); @@ -236,7 +236,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Disk.DefinitionStages.WithDiskSource diskDefWithoutData = client.disks() .define(getName()) @@ -291,7 +291,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Disk disk = client.disks().getById(getId()); @@ -318,7 +318,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.disks().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/SnapshotResource.java b/src/main/java/gyro/azure/compute/SnapshotResource.java index a301afb3..c429198f 100644 --- a/src/main/java/gyro/azure/compute/SnapshotResource.java +++ b/src/main/java/gyro/azure/compute/SnapshotResource.java @@ -253,7 +253,7 @@ public void copyFrom(Snapshot snapshot) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Snapshot snapshot = client.snapshots().getById(getId()); @@ -268,7 +268,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Snapshot.DefinitionStages.WithSnapshotSource withSnapshotSource = client.snapshots().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -329,7 +329,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.snapshots().getById(getId()) .update() @@ -340,7 +340,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.snapshots().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/VMScaleSetResource.java b/src/main/java/gyro/azure/compute/VMScaleSetResource.java index b52fe556..0cf9c542 100644 --- a/src/main/java/gyro/azure/compute/VMScaleSetResource.java +++ b/src/main/java/gyro/azure/compute/VMScaleSetResource.java @@ -858,7 +858,7 @@ public void copyFrom(VirtualMachineScaleSet scaleSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineScaleSet scaleSet = client.virtualMachineScaleSets().getById(getId()); @@ -873,7 +873,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineScaleSet.DefinitionStages.WithProximityPlacementGroup withProximityPlacementGroup = client.virtualMachineScaleSets() .define(getName()) @@ -1114,7 +1114,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineScaleSet scaleSet = client.virtualMachineScaleSets().getById(getId()); @@ -1243,7 +1243,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.virtualMachineScaleSets().deleteById(getId()); } @@ -1251,7 +1251,7 @@ public void delete(GyroUI ui, State state) { @Override public List getInstances() { List instances = new ArrayList<>(); - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineScaleSet virtualMachineScaleSet = client.virtualMachineScaleSets().getById(getId()); diff --git a/src/main/java/gyro/azure/compute/VMScaleSetScalingResource.java b/src/main/java/gyro/azure/compute/VMScaleSetScalingResource.java index d2436e00..941eb6c0 100644 --- a/src/main/java/gyro/azure/compute/VMScaleSetScalingResource.java +++ b/src/main/java/gyro/azure/compute/VMScaleSetScalingResource.java @@ -314,7 +314,7 @@ public void copyFrom(AutoscaleSetting autoscaleSetting) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AutoscaleSetting autoscaleSetting = client.autoscaleSettings().getById(getId()); @@ -329,7 +329,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AutoscaleSetting.DefinitionStages.DefineAutoscaleSettingResourceProfiles basicStage = client.autoscaleSettings() .define(getName()) @@ -420,7 +420,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AutoscaleSetting autoscaleSetting = client.autoscaleSettings().getById(getId()); @@ -515,7 +515,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.autoscaleSettings().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/VirtualMachineImageResource.java b/src/main/java/gyro/azure/compute/VirtualMachineImageResource.java index 6cfd5570..20a8e43e 100644 --- a/src/main/java/gyro/azure/compute/VirtualMachineImageResource.java +++ b/src/main/java/gyro/azure/compute/VirtualMachineImageResource.java @@ -170,7 +170,7 @@ public void copyFrom(VirtualMachineCustomImage image) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineCustomImage image = client.virtualMachineCustomImages().getById(getId()); @@ -185,7 +185,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachineCustomImage.DefinitionStages.WithCreate withCreate = client.virtualMachineCustomImages() .define(getName()) @@ -214,7 +214,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.virtualMachineCustomImages().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/compute/VirtualMachineResource.java b/src/main/java/gyro/azure/compute/VirtualMachineResource.java index c30af8cd..62a6e102 100644 --- a/src/main/java/gyro/azure/compute/VirtualMachineResource.java +++ b/src/main/java/gyro/azure/compute/VirtualMachineResource.java @@ -766,13 +766,13 @@ public void copyFrom(VirtualMachine virtualMachine) { .orElse(null); setLaunchDate(instanceViewStatus != null ? Date.from(instanceViewStatus.time().toInstant()) : null); - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); setPrivateIpAddress(client.networkInterfaces().getById(getNetworkInterface().getId()).primaryPrivateIP()); } @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachine virtualMachine = client.virtualMachines().getById(getId()); @@ -787,7 +787,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - VirtualMachine virtualMachine = doVMFluentWorkflow(createClient()).create(); + VirtualMachine virtualMachine = doVMFluentWorkflow(createClient(AzureResourceManager.class)).create(); setId(virtualMachine.id()); setVmId(virtualMachine.vmId()); copyFrom(virtualMachine); @@ -1237,7 +1237,7 @@ private WithCreate configureUnmanagedDataDisks( @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachine virtualMachine = client.virtualMachines().getById(getId()); @@ -1302,7 +1302,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); VirtualMachine virtualMachine = client.virtualMachines().getById(getId()); client.virtualMachines().deleteById(getId()); diff --git a/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java b/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java index b7b2581e..54accaa8 100644 --- a/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java +++ b/src/main/java/gyro/azure/containerservice/KubernetesClusterResource.java @@ -500,7 +500,7 @@ public void copyFrom(KubernetesCluster cluster) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); KubernetesClusters kubernetesClusters = client.kubernetesClusters(); KubernetesCluster cluster = kubernetesClusters.list().stream() .filter(o -> o.name().equals(getName())) @@ -518,7 +518,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); WithServicePrincipalClientId withServicePrincipalClientId = client.kubernetesClusters() .define(getName()) @@ -661,7 +661,7 @@ public void create(GyroUI ui, State state) throws Exception { public void update( GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); KubernetesCluster cluster = client.kubernetesClusters() .getByResourceGroup(getResourceGroup().getName(), getName()); @@ -792,7 +792,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.kubernetesClusters().deleteByResourceGroup(getResourceGroup().getName(), getName()); } diff --git a/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountResource.java b/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountResource.java index b99a25dd..a10f8f15 100644 --- a/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountResource.java +++ b/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountResource.java @@ -287,7 +287,7 @@ public void copyFrom(CosmosDBAccount cosmosAccount) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CosmosDBAccount cosmosAccount = client.cosmosDBAccounts().getById(getId()); @@ -302,7 +302,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); WithKind withKind = client.cosmosDBAccounts() .define(getName()) @@ -357,7 +357,7 @@ && getMaxInterval() != null) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CosmosDBAccount.Update update = client.cosmosDBAccounts() .getById(getId()) @@ -417,7 +417,7 @@ && getMaxInterval() != null) { @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.cosmosDBAccounts().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/dns/ARecordSetResource.java b/src/main/java/gyro/azure/dns/ARecordSetResource.java index 8605b83f..5f697bf4 100644 --- a/src/main/java/gyro/azure/dns/ARecordSetResource.java +++ b/src/main/java/gyro/azure/dns/ARecordSetResource.java @@ -160,7 +160,7 @@ public void copyFrom(ARecordSet aRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); com.azure.resourcemanager.dns.models.ARecordSet aRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -178,7 +178,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.ARecordSetBlank updateARecordSetBlank = client.dnsZones() .getById(getDnsZone().getId()) @@ -205,7 +205,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateARecordSet updateARecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateARecordSet(getName()); @@ -254,7 +254,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutARecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/AaaaRecordSetResource.java b/src/main/java/gyro/azure/dns/AaaaRecordSetResource.java index 3cd4449d..c5254258 100644 --- a/src/main/java/gyro/azure/dns/AaaaRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/AaaaRecordSetResource.java @@ -163,7 +163,7 @@ public void copyFrom(AaaaRecordSet aaaaRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); AaaaRecordSet aaaaRecordSet = client.dnsZones().getById(getDnsZone().getId()).aaaaRecordSets().getByName(getName()); @@ -178,7 +178,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.AaaaRecordSetBlank defineAaaaRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().defineAaaaRecordSet(getName()); @@ -203,7 +203,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateAaaaRecordSet updateAaaaRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateAaaaRecordSet(getName()); @@ -252,7 +252,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutAaaaRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/CaaRecordSetResource.java b/src/main/java/gyro/azure/dns/CaaRecordSetResource.java index 75102bb3..f2a2772d 100644 --- a/src/main/java/gyro/azure/dns/CaaRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/CaaRecordSetResource.java @@ -179,7 +179,7 @@ public void copyFrom(CaaRecordSet caaRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CaaRecordSet caaRecordSet = client.dnsZones().getById(getDnsZone().getId()).caaRecordSets().getByName(getName()); @@ -194,7 +194,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.CaaRecordSetBlank defineCaaRecordSet = client.dnsZones() @@ -225,7 +225,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateCaaRecordSet updateCaaRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateCaaRecordSet(getName()); @@ -272,7 +272,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutCaaRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/CnameRecordSetResource.java b/src/main/java/gyro/azure/dns/CnameRecordSetResource.java index 6b823d26..7349f929 100644 --- a/src/main/java/gyro/azure/dns/CnameRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/CnameRecordSetResource.java @@ -153,7 +153,7 @@ public void copyFrom(CnameRecordSet cnameRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); CnameRecordSet cnameRecordSet = client.dnsZones().getById(getDnsZone().getId()).cNameRecordSets().getByName(getName()); @@ -168,7 +168,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.WithCNameRecordSetAttachable createCNameRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -191,7 +191,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateCNameRecordSet updateCNameRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateCNameRecordSet(getName()); @@ -230,7 +230,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutCaaRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/DnsZoneResource.java b/src/main/java/gyro/azure/dns/DnsZoneResource.java index b8a8aeab..482eb5c1 100644 --- a/src/main/java/gyro/azure/dns/DnsZoneResource.java +++ b/src/main/java/gyro/azure/dns/DnsZoneResource.java @@ -167,7 +167,7 @@ public void copyFrom(DnsZone dnsZone) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsZone dnsZone = client.dnsZones().getById(getId()); @@ -182,7 +182,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsZone.DefinitionStages.WithCreate withCreate; @@ -201,7 +201,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsZone.Update update = client.dnsZones().getById(getId()).update(); @@ -214,7 +214,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/dns/MxRecordSetResource.java b/src/main/java/gyro/azure/dns/MxRecordSetResource.java index 807ab752..3586e448 100644 --- a/src/main/java/gyro/azure/dns/MxRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/MxRecordSetResource.java @@ -177,7 +177,7 @@ public void copyFrom(MxRecordSet mxRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); MxRecordSet mxRecordSet = client.dnsZones().getById(getDnsZone().getId()).mxRecordSets().getByName(getName()); @@ -192,7 +192,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.MXRecordSetBlank defineMXRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -221,7 +221,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateMXRecordSet updateMXRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateMXRecordSet(getName()); @@ -281,7 +281,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutMXRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/PtrRecordSetResource.java b/src/main/java/gyro/azure/dns/PtrRecordSetResource.java index 0b9a4978..c95c8fb3 100644 --- a/src/main/java/gyro/azure/dns/PtrRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/PtrRecordSetResource.java @@ -161,7 +161,7 @@ public void copyFrom(PtrRecordSet ptrRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); PtrRecordSet ptrRecordSet = client.dnsZones().getById(getDnsZone().getId()).ptrRecordSets().getByName(getName()); @@ -175,7 +175,7 @@ public boolean refresh() { } public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.PtrRecordSetBlank definePtrRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -203,7 +203,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdatePtrRecordSet updatePtrRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updatePtrRecordSet(getName()); @@ -252,7 +252,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutPtrRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/SrvRecordSetResource.java b/src/main/java/gyro/azure/dns/SrvRecordSetResource.java index aaef32a4..61257540 100644 --- a/src/main/java/gyro/azure/dns/SrvRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/SrvRecordSetResource.java @@ -174,7 +174,7 @@ public void copyFrom(SrvRecordSet srvRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SrvRecordSet srvRecordSet = client.dnsZones().getById(getDnsZone().getId()).srvRecordSets().getByName(getName()); @@ -189,7 +189,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.SrvRecordSetBlank defineSrvRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -216,7 +216,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateSrvRecordSet updateSrvRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateSrvRecordSet(getName()); @@ -262,7 +262,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutSrvRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/dns/TxtRecordSetResource.java b/src/main/java/gyro/azure/dns/TxtRecordSetResource.java index 54b9447e..83028976 100644 --- a/src/main/java/gyro/azure/dns/TxtRecordSetResource.java +++ b/src/main/java/gyro/azure/dns/TxtRecordSetResource.java @@ -162,7 +162,7 @@ public void copyFrom(TxtRecordSet txtRecordSet) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); TxtRecordSet txtRecordSet = client.dnsZones().getById(getDnsZone().getId()).txtRecordSets().getByName(getName()); @@ -177,7 +177,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateDefinitionStages.TxtRecordSetBlank defineTxtRecordSet = client.dnsZones() .getById(getDnsZone().getId()) @@ -204,7 +204,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); DnsRecordSet.UpdateTxtRecordSet updateTxtRecordSet = client.dnsZones().getById(getDnsZone().getId()).update().updateTxtRecordSet(getName()); @@ -253,7 +253,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.dnsZones().getById(getDnsZone().getId()).update().withoutTxtRecordSet(getName()).apply(); } diff --git a/src/main/java/gyro/azure/identity/IdentityResource.java b/src/main/java/gyro/azure/identity/IdentityResource.java index 0f387215..0e3391c2 100644 --- a/src/main/java/gyro/azure/identity/IdentityResource.java +++ b/src/main/java/gyro/azure/identity/IdentityResource.java @@ -164,7 +164,7 @@ public void copyFrom(Identity identity) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Identity identity = client.identities().getById(getId()); @@ -179,7 +179,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Identity identity = client.identities().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -192,7 +192,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Identity.Update update = client.identities().getById(getId()).update(); IdentityResource oldResource = (IdentityResource) current; @@ -212,7 +212,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.identities().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/keyvault/KeyVaultResource.java b/src/main/java/gyro/azure/keyvault/KeyVaultResource.java index efe2edcd..da008c3a 100644 --- a/src/main/java/gyro/azure/keyvault/KeyVaultResource.java +++ b/src/main/java/gyro/azure/keyvault/KeyVaultResource.java @@ -405,7 +405,7 @@ public void copyFrom(Vault vault) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Vault vault = client.vaults().getByResourceGroup(getResourceGroup().getName(), getName()); @@ -420,7 +420,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Vault.DefinitionStages.WithCreate withCreate = client.vaults().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -463,7 +463,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update( GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Vault vault = client.vaults().getById(getId()); @@ -526,7 +526,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.vaults().deleteById(getId()); @@ -536,7 +536,7 @@ public void delete(GyroUI ui, State state) throws Exception { } Vault getKeyVault() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); return client.vaults().getByResourceGroup(getResourceGroup().getName(), getName()); } diff --git a/src/main/java/gyro/azure/network/ApplicationGatewayResource.java b/src/main/java/gyro/azure/network/ApplicationGatewayResource.java index 76a637c0..3415a875 100644 --- a/src/main/java/gyro/azure/network/ApplicationGatewayResource.java +++ b/src/main/java/gyro/azure/network/ApplicationGatewayResource.java @@ -547,7 +547,7 @@ public Map backendHealth() { Map healthMap = new HashMap<>(); int total = 0; - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationGateway applicationGateway = client.applicationGateways().getById(getId()); if (applicationGateway != null) { @@ -655,7 +655,7 @@ public void copyFrom(ApplicationGateway applicationGateway) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationGateway applicationGateway = client.applicationGateways().getById(getId()); @@ -670,7 +670,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationGateway.DefinitionStages.WithRequestRoutingRule withRequestRoutingRule = client.applicationGateways() .define(getName()).withRegion(Region.fromName(getRegion())) @@ -735,7 +735,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource resource, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationGateway applicationGateway = client.applicationGateways().getById(getId()); @@ -774,7 +774,7 @@ public void update(GyroUI ui, State state, Resource resource, Set change @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.applicationGateways().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/ApplicationSecurityGroupResource.java b/src/main/java/gyro/azure/network/ApplicationSecurityGroupResource.java index 537636c7..0c25dd05 100644 --- a/src/main/java/gyro/azure/network/ApplicationSecurityGroupResource.java +++ b/src/main/java/gyro/azure/network/ApplicationSecurityGroupResource.java @@ -180,7 +180,7 @@ public void copyFrom(ApplicationSecurityGroup applicationSecurityGroup) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationSecurityGroup applicationSecurityGroup = client.applicationSecurityGroups().getById(getId()); @@ -195,7 +195,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ApplicationSecurityGroup applicationSecurityGroup = client.applicationSecurityGroups().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -208,14 +208,14 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.applicationSecurityGroups().getById(getId()).update().withTags(getTags()).apply(); } @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.applicationSecurityGroups().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/LoadBalancerResource.java b/src/main/java/gyro/azure/network/LoadBalancerResource.java index b2004d77..1a355918 100644 --- a/src/main/java/gyro/azure/network/LoadBalancerResource.java +++ b/src/main/java/gyro/azure/network/LoadBalancerResource.java @@ -386,7 +386,7 @@ public void copyFrom(LoadBalancer loadBalancer) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); LoadBalancer loadBalancer = client.loadBalancers().getById(getId()); @@ -401,7 +401,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); LoadBalancer.DefinitionStages.WithLBRuleOrNat lb = client.loadBalancers() .define(getName()) @@ -506,7 +506,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); LoadBalancer loadBalancer = client.loadBalancers().getById(getId()); @@ -633,7 +633,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.loadBalancers().deleteByResourceGroup(getResourceGroup().getName(), getName()); } diff --git a/src/main/java/gyro/azure/network/NetworkInterfaceResource.java b/src/main/java/gyro/azure/network/NetworkInterfaceResource.java index cad29c4c..f19cb274 100644 --- a/src/main/java/gyro/azure/network/NetworkInterfaceResource.java +++ b/src/main/java/gyro/azure/network/NetworkInterfaceResource.java @@ -223,7 +223,7 @@ public void copyFrom(NetworkInterface networkInterface) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterface networkInterface = getNetworkInterface(client); @@ -238,7 +238,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterface.DefinitionStages.WithPrimaryPrivateIP withPrimaryPrivateIP = client.networkInterfaces() .define(getName()) @@ -286,7 +286,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterface networkInterface = getNetworkInterface(client); @@ -316,7 +316,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.networkInterfaces().deleteByResourceGroup(getResourceGroup().getName(), getName()); } diff --git a/src/main/java/gyro/azure/network/NetworkResource.java b/src/main/java/gyro/azure/network/NetworkResource.java index e72508ab..a634f64d 100644 --- a/src/main/java/gyro/azure/network/NetworkResource.java +++ b/src/main/java/gyro/azure/network/NetworkResource.java @@ -245,7 +245,7 @@ public void copyFrom(Network network) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Network network = client.networks().getById(getId()); @@ -260,7 +260,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Network.DefinitionStages.WithCreate networkDefWithoutAddress = client.networks() .define(getName()) @@ -284,7 +284,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Network network = client.networks().getById(getId()); @@ -322,7 +322,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.networks().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/NetworkSecurityGroupResource.java b/src/main/java/gyro/azure/network/NetworkSecurityGroupResource.java index 06fdd0a5..215de2ea 100644 --- a/src/main/java/gyro/azure/network/NetworkSecurityGroupResource.java +++ b/src/main/java/gyro/azure/network/NetworkSecurityGroupResource.java @@ -171,7 +171,7 @@ public void copyFrom(NetworkSecurityGroup networkSecurityGroup) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroup networkSecurityGroup = client.networkSecurityGroups().getById(getId()); @@ -186,7 +186,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroup networkSecurityGroup = client.networkSecurityGroups() .define(getName()) @@ -200,7 +200,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroup networkSecurityGroup = client.networkSecurityGroups().getById(getId()); @@ -209,7 +209,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.networkSecurityGroups().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/NetworkSecurityGroupRuleResource.java b/src/main/java/gyro/azure/network/NetworkSecurityGroupRuleResource.java index c2162df9..fc248836 100644 --- a/src/main/java/gyro/azure/network/NetworkSecurityGroupRuleResource.java +++ b/src/main/java/gyro/azure/network/NetworkSecurityGroupRuleResource.java @@ -290,7 +290,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroupResource parent = (NetworkSecurityGroupResource) parent(); @@ -356,7 +356,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroupResource parent = (NetworkSecurityGroupResource) parent(); @@ -411,7 +411,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkSecurityGroupResource parent = (NetworkSecurityGroupResource) parent(); diff --git a/src/main/java/gyro/azure/network/NicIpConfigurationResource.java b/src/main/java/gyro/azure/network/NicIpConfigurationResource.java index 7dc70608..ab059fce 100644 --- a/src/main/java/gyro/azure/network/NicIpConfigurationResource.java +++ b/src/main/java/gyro/azure/network/NicIpConfigurationResource.java @@ -185,7 +185,7 @@ public void create(GyroUI ui, State state) { return; } - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterfaceResource parent = (NetworkInterfaceResource) parent(); @@ -229,7 +229,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterfaceResource parent = (NetworkInterfaceResource) parent(); @@ -303,7 +303,7 @@ public void delete(GyroUI ui, State state) { return; } - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkInterfaceResource parent = (NetworkInterfaceResource) parent(); diff --git a/src/main/java/gyro/azure/network/PublicIpAddressResource.java b/src/main/java/gyro/azure/network/PublicIpAddressResource.java index fe21d5e3..83171089 100644 --- a/src/main/java/gyro/azure/network/PublicIpAddressResource.java +++ b/src/main/java/gyro/azure/network/PublicIpAddressResource.java @@ -319,7 +319,7 @@ public void copyFrom(PublicIpAddress publicIpAddress) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); PublicIpAddress publicIpAddress = client.publicIpAddresses().getById(getId()); @@ -334,7 +334,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); PublicIpAddress.DefinitionStages.WithCreate withCreate = client.publicIpAddresses() .define(getName()) @@ -382,7 +382,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); PublicIpAddress publicIpAddress = client.publicIpAddresses().getById(getId()); @@ -425,7 +425,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.publicIpAddresses().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/RouteTableResource.java b/src/main/java/gyro/azure/network/RouteTableResource.java index 5c657205..c9fa4782 100644 --- a/src/main/java/gyro/azure/network/RouteTableResource.java +++ b/src/main/java/gyro/azure/network/RouteTableResource.java @@ -176,7 +176,7 @@ public void copyFrom(RouteTable routeTable) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); RouteTable routeTable = client.routeTables().getById(getId()); @@ -191,7 +191,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); RouteTable.DefinitionStages.WithCreate withCreate; withCreate = client.routeTables().define(getName()) @@ -220,7 +220,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); RouteTableResource currentResource = (RouteTableResource) current; @@ -255,7 +255,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.routeTables().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/network/SubnetResource.java b/src/main/java/gyro/azure/network/SubnetResource.java index 6dccd472..c109df5b 100644 --- a/src/main/java/gyro/azure/network/SubnetResource.java +++ b/src/main/java/gyro/azure/network/SubnetResource.java @@ -160,7 +160,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkResource parent = (NetworkResource) parent(); @@ -190,7 +190,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkResource parent = (NetworkResource) parent(); @@ -237,7 +237,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); NetworkResource parent = (NetworkResource) parent(); diff --git a/src/main/java/gyro/azure/registries/RegistryResource.java b/src/main/java/gyro/azure/registries/RegistryResource.java index d8bbe349..873824f7 100644 --- a/src/main/java/gyro/azure/registries/RegistryResource.java +++ b/src/main/java/gyro/azure/registries/RegistryResource.java @@ -244,7 +244,7 @@ public void copyFrom(Registry registry) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Registry registry = client.containerRegistries() .getByResourceGroup(getResourceGroup().getName(), getName()); @@ -260,7 +260,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Registry.DefinitionStages.WithSku withSku = client.containerRegistries() .define(getName()) @@ -315,7 +315,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update( GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); Registry registry = client.containerRegistries() .getByResourceGroup(getResourceGroup().getName(), getName()); @@ -366,7 +366,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.containerRegistries().deleteByResourceGroup(getResourceGroup().getName(), getName()); } diff --git a/src/main/java/gyro/azure/resources/ResourceGroupResource.java b/src/main/java/gyro/azure/resources/ResourceGroupResource.java index a772d5a1..f629582e 100644 --- a/src/main/java/gyro/azure/resources/ResourceGroupResource.java +++ b/src/main/java/gyro/azure/resources/ResourceGroupResource.java @@ -107,7 +107,7 @@ public void copyFrom(ResourceGroup resourceGroup) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); if (!client.resourceGroups().contain(getName())) { return false; @@ -121,7 +121,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ResourceGroup resourceGroup = client.resourceGroups() .define(getName()) @@ -134,7 +134,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ResourceGroup resourceGroup = client.resourceGroups().getByName(getName()); @@ -143,7 +143,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.resourceGroups().deleteByName(getName()); } diff --git a/src/main/java/gyro/azure/sql/SqlDatabaseResource.java b/src/main/java/gyro/azure/sql/SqlDatabaseResource.java index 35ab9bd8..98442f15 100644 --- a/src/main/java/gyro/azure/sql/SqlDatabaseResource.java +++ b/src/main/java/gyro/azure/sql/SqlDatabaseResource.java @@ -330,7 +330,7 @@ public void copyFrom(SqlDatabase database) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlDatabase database = getSqlDatabase(client); @@ -345,7 +345,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlDatabaseOperations.DefinitionStages.WithAllDifferentOptions buildDatabase = client.sqlServers() .getById(getSqlServer().getId()) @@ -452,7 +452,7 @@ && getImportFromFilename() != null) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlDatabase.Update update = getSqlDatabase(client).update(); @@ -492,7 +492,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlDatabase sqlDatabase = getSqlDatabase(client); if (sqlDatabase != null) { diff --git a/src/main/java/gyro/azure/sql/SqlElasticPoolResource.java b/src/main/java/gyro/azure/sql/SqlElasticPoolResource.java index 11221b73..50bb40f7 100644 --- a/src/main/java/gyro/azure/sql/SqlElasticPoolResource.java +++ b/src/main/java/gyro/azure/sql/SqlElasticPoolResource.java @@ -245,7 +245,7 @@ public void copyFrom(SqlElasticPool elasticPool) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlElasticPool elasticPool = getSqlElasticPool(client); @@ -264,7 +264,7 @@ public void create(GyroUI ui, State state) { throw new GyroException("You must provide a sql server resource."); } - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlElasticPoolOperations.DefinitionStages.WithEdition buildPool = client.sqlServers() .getById(getSqlServer().getId()) @@ -309,7 +309,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlElasticPool.Update update = getSqlElasticPool(client).update(); @@ -338,7 +338,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlElasticPool sqlElasticPool = getSqlElasticPool(client); sqlElasticPool.listDatabases().stream().map(SqlDatabase::name).forEach(sqlElasticPool::removeDatabase); diff --git a/src/main/java/gyro/azure/sql/SqlFailoverGroupResource.java b/src/main/java/gyro/azure/sql/SqlFailoverGroupResource.java index bc20471d..ca82f806 100644 --- a/src/main/java/gyro/azure/sql/SqlFailoverGroupResource.java +++ b/src/main/java/gyro/azure/sql/SqlFailoverGroupResource.java @@ -212,7 +212,7 @@ public void copyFrom(SqlFailoverGroup failoverGroup) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFailoverGroup failoverGroup = getSqlFailoverGroup(client); @@ -227,7 +227,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFailoverGroupOperations.DefinitionStages.WithReadWriteEndpointPolicy buildFailoverGroup = client.sqlServers() .getById(getSqlServer().getId()) @@ -269,7 +269,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFailoverGroup.Update update = getSqlFailoverGroup(client).update(); @@ -311,7 +311,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFailoverGroup sqlFailoverGroup = getSqlFailoverGroup(client); diff --git a/src/main/java/gyro/azure/sql/SqlFirewallRuleResource.java b/src/main/java/gyro/azure/sql/SqlFirewallRuleResource.java index a758102d..9ec8c82e 100644 --- a/src/main/java/gyro/azure/sql/SqlFirewallRuleResource.java +++ b/src/main/java/gyro/azure/sql/SqlFirewallRuleResource.java @@ -129,7 +129,7 @@ public void copyFrom(SqlFirewallRule firewallRule) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFirewallRule firewallRule = getSqlFirewallRule(client); @@ -154,7 +154,7 @@ public void create(GyroUI ui, State state) { throw new GyroException("You must provide a sql server resource."); } - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFirewallRuleOperations.DefinitionStages.WithIpAddressRange rule = client.sqlServers() .getById(getSqlServer().getId()) @@ -175,7 +175,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFirewallRule.Update update = getSqlFirewallRule(client).update(); @@ -190,7 +190,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlFirewallRule sqlFirewallRule = getSqlFirewallRule(client); diff --git a/src/main/java/gyro/azure/sql/SqlServerResource.java b/src/main/java/gyro/azure/sql/SqlServerResource.java index 7527cc5d..21a0681e 100644 --- a/src/main/java/gyro/azure/sql/SqlServerResource.java +++ b/src/main/java/gyro/azure/sql/SqlServerResource.java @@ -202,7 +202,7 @@ public void copyFrom(SqlServer sqlServer) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlServer sqlServer = client.sqlServers().getById(getId()); @@ -217,7 +217,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlServer.DefinitionStages.WithCreate withCreate = client.sqlServers().define(getName()) .withRegion(Region.fromName(getRegion())) @@ -242,7 +242,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlServer.Update update = client.sqlServers().getById(getId()).update(); @@ -257,7 +257,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.sqlServers().deleteById(getId()); } diff --git a/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleResource.java b/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleResource.java index 09558268..d01cfe3b 100644 --- a/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleResource.java +++ b/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleResource.java @@ -131,7 +131,7 @@ public void copyFrom(SqlVirtualNetworkRule virtualNetworkRule) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlVirtualNetworkRule virtualNetworkRule = getVirtualNetworkRule(client); @@ -150,7 +150,7 @@ public void create(GyroUI ui, State state) { throw new GyroException("You must provide a sql server resource."); } - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlVirtualNetworkRuleOperations.DefinitionStages.WithServiceEndpoint withServiceEndpoint = client.sqlServers() .getById(getSqlServer().getId()) @@ -165,7 +165,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedProperties) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlVirtualNetworkRule.Update update = getVirtualNetworkRule(client) .update() @@ -176,7 +176,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); SqlVirtualNetworkRule virtualNetworkRule = getVirtualNetworkRule(client); if (virtualNetworkRule != null) { diff --git a/src/main/java/gyro/azure/storage/StorageAccountResource.java b/src/main/java/gyro/azure/storage/StorageAccountResource.java index 4fbe61af..b8ec76aa 100644 --- a/src/main/java/gyro/azure/storage/StorageAccountResource.java +++ b/src/main/java/gyro/azure/storage/StorageAccountResource.java @@ -232,7 +232,7 @@ public void copyFrom(StorageAccount storageAccount) { @Override public boolean refresh() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccount storageAccount = client.storageAccounts() .getByResourceGroup(getResourceGroup().getName(), getName()); @@ -248,7 +248,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws URISyntaxException, InvalidKeyException { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccount.DefinitionStages.WithCreate withCreate = client.storageAccounts() .define(getName()) @@ -280,7 +280,7 @@ public void create(GyroUI ui, State state) throws URISyntaxException, InvalidKey @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) throws URISyntaxException, InvalidKeyException { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccount storageAccount = client.storageAccounts().getById(getId()); StorageAccount.Update update = storageAccount.update(); @@ -308,7 +308,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); client.storageAccounts().deleteById(getId()); } @@ -324,7 +324,7 @@ public Map keys() { Map keys = new HashMap<>(); if (getId() != null) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccount storageAccount = client.storageAccounts().getById(getId()); storageAccount.getKeys().forEach(e -> keys.put(e.keyName(), e.value())); @@ -334,7 +334,7 @@ public Map keys() { } protected StorageAccount getStorageAccount() { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); return client.storageAccounts().getById(getId()); } diff --git a/src/main/java/gyro/azure/storage/StorageLifeCycle.java b/src/main/java/gyro/azure/storage/StorageLifeCycle.java index 1040df37..09a877b3 100644 --- a/src/main/java/gyro/azure/storage/StorageLifeCycle.java +++ b/src/main/java/gyro/azure/storage/StorageLifeCycle.java @@ -133,7 +133,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccountResource parent = (StorageAccountResource) parent(); @@ -192,7 +192,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); ManagementPolicySchema policySchema = new ManagementPolicySchema(); policySchema.withRules(getRule().stream().map(PolicyRule::toManagementPolicyRule).collect(Collectors.toList())); @@ -205,7 +205,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - AzureResourceManager client = createClient(); + AzureResourceManager client = createClient(AzureResourceManager.class); StorageAccountResource parent = (StorageAccountResource) parent(); StorageAccount storageAccount = client.storageAccounts().getById(parent.getId()); From e6e373aa0640e9ae89b04b51ca073c4238a3f458 Mon Sep 17 00:00:00 2001 From: Harshil Sanjay Jain Date: Wed, 31 Jul 2024 16:58:11 -0400 Subject: [PATCH 2/2] Throw error for incorrect client requests --- src/main/java/gyro/azure/AzureCredentials.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/gyro/azure/AzureCredentials.java b/src/main/java/gyro/azure/AzureCredentials.java index b8195b58..8b1df928 100644 --- a/src/main/java/gyro/azure/AzureCredentials.java +++ b/src/main/java/gyro/azure/AzureCredentials.java @@ -102,7 +102,7 @@ public T createClient(Class clientClass) { throw new GyroException(error.getMessage(), error); } - } else { + } else if (clientClass.getSimpleName().equals("AzureResourceManager")) { try { AzureResourceManager.Authenticated authenticated = AzureResourceManager .configure() @@ -124,6 +124,10 @@ public T createClient(Class clientClass) { } catch (Exception error) { throw new GyroException(error.getMessage(), error); } + + } else { + throw new UnsupportedOperationException( + String.format("The following client type is not available: %s", clientClass.getSimpleName())); } }