diff --git a/build.gradle b/build.gradle index bd939965..3b826c59 100644 --- a/build.gradle +++ b/build.gradle @@ -70,6 +70,7 @@ dependencies { implementation enforcedPlatform('com.azure:azure-sdk-bom:1.2.25') implementation 'com.azure.resourcemanager:azure-resourcemanager:2.40.0' + implementation 'com.azure.resourcemanager:azure-resourcemanager-communication:2.1.0' implementation 'com.azure:azure-security-keyvault-certificates' implementation 'com.azure:azure-security-keyvault-keys' implementation 'com.azure:azure-security-keyvault-secrets' diff --git a/src/main/java/gyro/azure/AbstractAzureCommand.java b/src/main/java/gyro/azure/AbstractAzureCommand.java index 7c2a365a..9504733b 100644 --- a/src/main/java/gyro/azure/AbstractAzureCommand.java +++ b/src/main/java/gyro/azure/AbstractAzureCommand.java @@ -97,7 +97,7 @@ public AzureResourceManager getResourceManagerClient() { getCredential())); } - return AzureResource.createClient((AzureCredentials) credentials); + return AzureResource.createClient(AzureResourceManager.class, (AzureCredentials) credentials); } public TokenCredential getTokenCredential() { diff --git a/src/main/java/gyro/azure/AzureCredentials.java b/src/main/java/gyro/azure/AzureCredentials.java index eba2bec2..8b1df928 100644 --- a/src/main/java/gyro/azure/AzureCredentials.java +++ b/src/main/java/gyro/azure/AzureCredentials.java @@ -22,9 +22,11 @@ import com.azure.core.credential.TokenCredential; import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder; +import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; import com.azure.identity.ClientSecretCredentialBuilder; import com.azure.resourcemanager.AzureResourceManager; +import com.azure.resourcemanager.communication.CommunicationManager; import com.psddev.dari.util.ObjectUtils; import com.psddev.dari.util.StringUtils; import gyro.core.GyroException; @@ -60,7 +62,7 @@ public void setLogLevel(String logLevel) { this.logLevel = logLevel; } - public AzureResourceManager createClient() { + public T createClient(Class clientClass) { Properties properties; try (InputStream input = openInput(getCredentialFilePath())) { @@ -80,21 +82,52 @@ public AzureResourceManager createClient() { String subscription = ObjectUtils.to(String.class, properties.get("subscription")); - AzureProfile azureProfile = new AzureProfile(tenant, subscription, com.azure.core.management.AzureEnvironment.AZURE); + AzureProfile azureProfile = new AzureProfile(tenant, subscription, AzureEnvironment.AZURE); - try { - AzureResourceManager.Authenticated authenticated = AzureResourceManager - .configure() - .withHttpClient(new OkHttpAsyncHttpClientBuilder().build()) - .authenticate(credential, azureProfile); + if (clientClass.getSimpleName().equals("CommunicationManager")) { + try { + CommunicationManager client = CommunicationManager + .configure() + .withHttpClient(new OkHttpAsyncHttpClientBuilder().build()) + .authenticate(credential, azureProfile); + if (clientClass.isInstance(client)) { + return clientClass.cast(client); + } - return StringUtils.isBlank(subscription) - ? authenticated.withDefaultSubscription() - : authenticated.withSubscription(subscription); + throw new GyroException( + String.format("Unable to create %s client", clientClass.getSimpleName())); - } catch (Exception error) { - throw new GyroException(error.getMessage(), error); + } catch (Exception error) { + throw new GyroException(error.getMessage(), error); + } + + } else if (clientClass.getSimpleName().equals("AzureResourceManager")) { + try { + AzureResourceManager.Authenticated authenticated = AzureResourceManager + .configure() + .withHttpClient(new OkHttpAsyncHttpClientBuilder().build()) + .authenticate(credential, azureProfile); + + + AzureResourceManager client = StringUtils.isBlank(subscription) + ? authenticated.withDefaultSubscription() + : authenticated.withSubscription(subscription); + + if (clientClass.isInstance(client)) { + return clientClass.cast(client); + } + + throw new GyroException( + String.format("Unable to create %s client", clientClass.getSimpleName())); + + } 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())); } } diff --git a/src/main/java/gyro/azure/AzureFinder.java b/src/main/java/gyro/azure/AzureFinder.java index 17a43b23..9f5be2a9 100644 --- a/src/main/java/gyro/azure/AzureFinder.java +++ b/src/main/java/gyro/azure/AzureFinder.java @@ -22,13 +22,13 @@ import java.util.stream.Collectors; import com.azure.core.credential.TokenCredential; -import com.azure.resourcemanager.AzureResourceManager; +import com.psddev.dari.util.TypeDefinition; import gyro.core.finder.Finder; -public abstract class AzureFinder extends Finder { - protected abstract List findAllAzure(AzureResourceManager client); +public abstract class AzureFinder extends Finder { + protected abstract List findAllAzure(C client); - protected abstract List findAzure(AzureResourceManager client, Map filters); + protected abstract List findAzure(C client, Map filters); @Override public List find(Map filters) { @@ -44,8 +44,12 @@ public List findAll() { .collect(Collectors.toList()); } - private AzureResourceManager newClient() { - return AzureResource.createClient(credentials(AzureCredentials.class)); + private C newClient() { + @SuppressWarnings("unchecked") + Class clientClass = (Class) TypeDefinition.getInstance(getClass()) + .getInferredGenericTypeArgumentClass(AzureFinder.class, 0); + + return AzureResource.createClient(clientClass, credentials(AzureCredentials.class)); } protected TokenCredential getTokenCredential() { diff --git a/src/main/java/gyro/azure/AzureResource.java b/src/main/java/gyro/azure/AzureResource.java index e7f105af..a1d1b421 100644 --- a/src/main/java/gyro/azure/AzureResource.java +++ b/src/main/java/gyro/azure/AzureResource.java @@ -18,6 +18,7 @@ import com.azure.core.credential.TokenCredential; import com.azure.resourcemanager.AzureResourceManager; +import com.azure.resourcemanager.communication.CommunicationManager; import gyro.core.resource.Resource; public abstract class AzureResource extends Resource { @@ -26,12 +27,12 @@ protected String getRegion() { return credentials(AzureCredentials.class).getRegion(); } - public static AzureResourceManager createClient(AzureCredentials credentials) { - return credentials.createClient(); + public static T createClient(Class clientClass, AzureCredentials credentials) { + return credentials.createClient(clientClass); } - protected AzureResourceManager createClient() { - return AzureResource.createClient(credentials(AzureCredentials.class)); + protected T createClient(Class clientClass) { + return AzureResource.createClient(clientClass, credentials(AzureCredentials.class)); } public static TokenCredential getTokenCredential(AzureCredentials credentials) { diff --git a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupFinder.java b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupFinder.java index d6755a45..6db2e95a 100644 --- a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupFinder.java +++ b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryGroupFinder.java @@ -39,7 +39,7 @@ */ @Type("active-directory-group") public class ActiveDirectoryGroupFinder - extends AzureFinder { + extends AzureFinder { private String name; private String id; 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/ActiveDirectoryUserFinder.java b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserFinder.java index b1f05760..4b46914c 100644 --- a/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserFinder.java +++ b/src/main/java/gyro/azure/accessmanagement/ActiveDirectoryUserFinder.java @@ -39,7 +39,7 @@ */ @Type("active-directory-user") public class ActiveDirectoryUserFinder - extends AzureFinder { + extends AzureFinder { private String id; private String name; 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/ApplicationFinder.java b/src/main/java/gyro/azure/accessmanagement/ApplicationFinder.java index 00da2c25..2acdd19f 100644 --- a/src/main/java/gyro/azure/accessmanagement/ApplicationFinder.java +++ b/src/main/java/gyro/azure/accessmanagement/ApplicationFinder.java @@ -37,7 +37,7 @@ * application: $(external-query azure::application {}) */ @Type("application") -public class ApplicationFinder extends AzureFinder { +public class ApplicationFinder extends AzureFinder { private String id; 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/ServicePrincipalFinder.java b/src/main/java/gyro/azure/accessmanagement/ServicePrincipalFinder.java index aecdcf0e..3d8f63cd 100644 --- a/src/main/java/gyro/azure/accessmanagement/ServicePrincipalFinder.java +++ b/src/main/java/gyro/azure/accessmanagement/ServicePrincipalFinder.java @@ -37,7 +37,7 @@ * service-principal: $(external-query azure::service-principal {}) */ @Type("service-principal") -public class ServicePrincipalFinder extends AzureFinder { +public class ServicePrincipalFinder extends AzureFinder { private String id; 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/CdnProfileFinder.java b/src/main/java/gyro/azure/cdn/CdnProfileFinder.java index 0b045561..5edeebd1 100644 --- a/src/main/java/gyro/azure/cdn/CdnProfileFinder.java +++ b/src/main/java/gyro/azure/cdn/CdnProfileFinder.java @@ -37,7 +37,7 @@ * cdn-profile: $(external-query azure::cdn-profile {}) */ @Type("cdn-profile") -public class CdnProfileFinder extends AzureFinder { +public class CdnProfileFinder extends AzureFinder { private String id; 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/AvailabilitySetFinder.java b/src/main/java/gyro/azure/compute/AvailabilitySetFinder.java index 08d08c43..55a896eb 100644 --- a/src/main/java/gyro/azure/compute/AvailabilitySetFinder.java +++ b/src/main/java/gyro/azure/compute/AvailabilitySetFinder.java @@ -37,7 +37,7 @@ * availability-set: $(external-query azure::availability-set {}) */ @Type("availability-set") -public class AvailabilitySetFinder extends AzureFinder { +public class AvailabilitySetFinder extends AzureFinder { private String id; 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/DiskFinder.java b/src/main/java/gyro/azure/compute/DiskFinder.java index aa7aeb92..3a62b07f 100644 --- a/src/main/java/gyro/azure/compute/DiskFinder.java +++ b/src/main/java/gyro/azure/compute/DiskFinder.java @@ -37,7 +37,7 @@ * disk: $(external-query azure::disk {}) */ @Type("disk") -public class DiskFinder extends AzureFinder { +public class DiskFinder extends AzureFinder { private String id; 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/SnapshotFinder.java b/src/main/java/gyro/azure/compute/SnapshotFinder.java index bf4c04b0..ac6726e4 100644 --- a/src/main/java/gyro/azure/compute/SnapshotFinder.java +++ b/src/main/java/gyro/azure/compute/SnapshotFinder.java @@ -37,7 +37,7 @@ * snapshot: $(external-query azure::snapshot {}) */ @Type("snapshot") -public class SnapshotFinder extends AzureFinder { +public class SnapshotFinder extends AzureFinder { private String id; 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/VMScaleSetFinder.java b/src/main/java/gyro/azure/compute/VMScaleSetFinder.java index 9456e6de..7755659b 100644 --- a/src/main/java/gyro/azure/compute/VMScaleSetFinder.java +++ b/src/main/java/gyro/azure/compute/VMScaleSetFinder.java @@ -37,7 +37,7 @@ * scale-set: $(external-query azure::scale-set {}) */ @Type("scale-set") -public class VMScaleSetFinder extends AzureFinder { +public class VMScaleSetFinder extends AzureFinder { private String id; 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/VMScaleSetScalingFinder.java b/src/main/java/gyro/azure/compute/VMScaleSetScalingFinder.java index abcc8f73..8a10ac39 100644 --- a/src/main/java/gyro/azure/compute/VMScaleSetScalingFinder.java +++ b/src/main/java/gyro/azure/compute/VMScaleSetScalingFinder.java @@ -37,7 +37,7 @@ * scale-set-scaling: $(external-query azure::scale-set-scaling {}) */ @Type("scale-set-scaling") -public class VMScaleSetScalingFinder extends AzureFinder { +public class VMScaleSetScalingFinder extends AzureFinder { private String id; 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/VirtualMachineFinder.java b/src/main/java/gyro/azure/compute/VirtualMachineFinder.java index d64c7e2c..800837fa 100644 --- a/src/main/java/gyro/azure/compute/VirtualMachineFinder.java +++ b/src/main/java/gyro/azure/compute/VirtualMachineFinder.java @@ -37,7 +37,7 @@ * virtual-machine: $(external-query azure::virtual-machine {}) */ @Type("virtual-machine") -public class VirtualMachineFinder extends AzureFinder { +public class VirtualMachineFinder extends AzureFinder { private String id; diff --git a/src/main/java/gyro/azure/compute/VirtualMachineImageFinder.java b/src/main/java/gyro/azure/compute/VirtualMachineImageFinder.java index 3fbc78e5..970384b1 100644 --- a/src/main/java/gyro/azure/compute/VirtualMachineImageFinder.java +++ b/src/main/java/gyro/azure/compute/VirtualMachineImageFinder.java @@ -38,7 +38,7 @@ */ @Type("virtual-machine-image") public class VirtualMachineImageFinder - extends AzureFinder { + extends AzureFinder { private String id; 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/KubernetesClusterFinder.java b/src/main/java/gyro/azure/containerservice/KubernetesClusterFinder.java index ccbfeb09..a8b83f0d 100644 --- a/src/main/java/gyro/azure/containerservice/KubernetesClusterFinder.java +++ b/src/main/java/gyro/azure/containerservice/KubernetesClusterFinder.java @@ -37,7 +37,7 @@ * kubernetes-cluster: $(external-query azure::kubernetes-cluster {}) */ @Type("kubernetes-cluster") -public class KubernetesClusterFinder extends AzureFinder { +public class KubernetesClusterFinder extends AzureFinder { private String id; 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/CosmosDBAccountFinder.java b/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountFinder.java index 09d78a90..56f87331 100644 --- a/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountFinder.java +++ b/src/main/java/gyro/azure/cosmosdb/CosmosDBAccountFinder.java @@ -37,7 +37,7 @@ * cosmos-db: $(external-query azure::cosmos-db {}) */ @Type("cosmos-db") -public class CosmosDBAccountFinder extends AzureFinder { +public class CosmosDBAccountFinder extends AzureFinder { private String id; /** 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/ARecordSetFinder.java b/src/main/java/gyro/azure/dns/ARecordSetFinder.java index d39ffb1b..d117c4f7 100644 --- a/src/main/java/gyro/azure/dns/ARecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/ARecordSetFinder.java @@ -40,7 +40,7 @@ * a-record-set: $(external-query azure::a-record-set {}) */ @Type("a-record-set") -public class ARecordSetFinder extends AzureFinder { +public class ARecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/AaaaRecordSetFinder.java b/src/main/java/gyro/azure/dns/AaaaRecordSetFinder.java index bb8a498e..0bcc59d5 100644 --- a/src/main/java/gyro/azure/dns/AaaaRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/AaaaRecordSetFinder.java @@ -40,7 +40,7 @@ * aaaa-record-set: $(external-query azure::aaaa-record-set {}) */ @Type("aaaa-record-set") -public class AaaaRecordSetFinder extends AzureFinder { +public class AaaaRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/CaaRecordSetFinder.java b/src/main/java/gyro/azure/dns/CaaRecordSetFinder.java index 407b5b53..c7749bfb 100644 --- a/src/main/java/gyro/azure/dns/CaaRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/CaaRecordSetFinder.java @@ -40,7 +40,7 @@ * caa-record-set: $(external-query azure::caa-record-set {}) */ @Type("caa-record-set") -public class CaaRecordSetFinder extends AzureFinder { +public class CaaRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/CnameRecordSetFinder.java b/src/main/java/gyro/azure/dns/CnameRecordSetFinder.java index 2178e503..aec05091 100644 --- a/src/main/java/gyro/azure/dns/CnameRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/CnameRecordSetFinder.java @@ -40,7 +40,7 @@ * cname-record-set: $(external-query azure::cname-record-set {}) */ @Type("cname-record-set") -public class CnameRecordSetFinder extends AzureFinder { +public class CnameRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/DnsZoneFinder.java b/src/main/java/gyro/azure/dns/DnsZoneFinder.java index 82dd0abb..c7422c65 100644 --- a/src/main/java/gyro/azure/dns/DnsZoneFinder.java +++ b/src/main/java/gyro/azure/dns/DnsZoneFinder.java @@ -16,6 +16,11 @@ package gyro.azure.dns; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + import com.azure.resourcemanager.AzureResourceManager; import com.azure.resourcemanager.dns.models.DnsZone; import com.psddev.dari.util.ObjectUtils; @@ -23,11 +28,6 @@ import gyro.core.GyroException; import gyro.core.Type; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - /** * Query dns zone. * @@ -39,7 +39,7 @@ * dns-zone: $(external-query azure::dns-zone {}) */ @Type("dns-zone") -public class DnsZoneFinder extends AzureFinder { +public class DnsZoneFinder extends AzureFinder { private String id; /** 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/MxRecordSetFinder.java b/src/main/java/gyro/azure/dns/MxRecordSetFinder.java index 7de2405a..a41d2ecb 100644 --- a/src/main/java/gyro/azure/dns/MxRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/MxRecordSetFinder.java @@ -40,7 +40,7 @@ * mx-record-set: $(external-query azure::mx-record-set {}) */ @Type("mx-record-set") -public class MxRecordSetFinder extends AzureFinder { +public class MxRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/PtrRecordSetFinder.java b/src/main/java/gyro/azure/dns/PtrRecordSetFinder.java index 34e69e47..69ab9500 100644 --- a/src/main/java/gyro/azure/dns/PtrRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/PtrRecordSetFinder.java @@ -40,7 +40,7 @@ * ptr-record-set: $(external-query azure::ptr-record-set {}) */ @Type("ptr-record-set") -public class PtrRecordSetFinder extends AzureFinder { +public class PtrRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/SrvRecordSetFinder.java b/src/main/java/gyro/azure/dns/SrvRecordSetFinder.java index 3d30cc17..159a63a7 100644 --- a/src/main/java/gyro/azure/dns/SrvRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/SrvRecordSetFinder.java @@ -40,7 +40,7 @@ * srv-record-set: $(external-query azure::srv-record-set {}) */ @Type("srv-record-set") -public class SrvRecordSetFinder extends AzureFinder { +public class SrvRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/TxtRecordSetFinder.java b/src/main/java/gyro/azure/dns/TxtRecordSetFinder.java index cde37c52..0bf02701 100644 --- a/src/main/java/gyro/azure/dns/TxtRecordSetFinder.java +++ b/src/main/java/gyro/azure/dns/TxtRecordSetFinder.java @@ -40,7 +40,7 @@ * txt-record-set: $(external-query azure::txt-record-set {}) */ @Type("txt-record-set") -public class TxtRecordSetFinder extends AzureFinder { +public class TxtRecordSetFinder extends AzureFinder { private String dnsZoneId; private String name; 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/IdentityFinder.java b/src/main/java/gyro/azure/identity/IdentityFinder.java index b3e8f259..a15ac4e8 100644 --- a/src/main/java/gyro/azure/identity/IdentityFinder.java +++ b/src/main/java/gyro/azure/identity/IdentityFinder.java @@ -37,7 +37,7 @@ * identity: $(external-query azure::identity {}) */ @Type("identity") -public class IdentityFinder extends AzureFinder { +public class IdentityFinder extends AzureFinder { private String id; /** 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/KeyVaultCertificateFinder.java b/src/main/java/gyro/azure/keyvault/KeyVaultCertificateFinder.java index f885c0f5..e8b49111 100644 --- a/src/main/java/gyro/azure/keyvault/KeyVaultCertificateFinder.java +++ b/src/main/java/gyro/azure/keyvault/KeyVaultCertificateFinder.java @@ -40,7 +40,7 @@ * certificate: $(external-query azure::key-vault-certificate {resource-group: "resource-group-example", vault: "vault-example", name: "certificate-example"}) */ @Type("key-vault-certificate") -public class KeyVaultCertificateFinder extends AzureFinder { +public class KeyVaultCertificateFinder extends AzureFinder { private String resourceGroup; private String vault; diff --git a/src/main/java/gyro/azure/keyvault/KeyVaultFinder.java b/src/main/java/gyro/azure/keyvault/KeyVaultFinder.java index 28b30190..0a7a7a4a 100644 --- a/src/main/java/gyro/azure/keyvault/KeyVaultFinder.java +++ b/src/main/java/gyro/azure/keyvault/KeyVaultFinder.java @@ -38,7 +38,7 @@ * identity: $(external-query azure::key-vault {resource-group: "resource-group-example", name: "vault-example"}) */ @Type("key-vault") -public class KeyVaultFinder extends AzureFinder { +public class KeyVaultFinder extends AzureFinder { private String resourceGroup; private String name; diff --git a/src/main/java/gyro/azure/keyvault/KeyVaultKeyFinder.java b/src/main/java/gyro/azure/keyvault/KeyVaultKeyFinder.java index 6b5d510a..e70b9776 100644 --- a/src/main/java/gyro/azure/keyvault/KeyVaultKeyFinder.java +++ b/src/main/java/gyro/azure/keyvault/KeyVaultKeyFinder.java @@ -21,7 +21,7 @@ * certificate: $(external-query azure::key-vault-key {resource-group: "resource-group-example", vault: "vault-example", name: "key-example"}) */ @Type("key-vault-key") -public class KeyVaultKeyFinder extends AzureFinder { +public class KeyVaultKeyFinder extends AzureFinder { private String resourceGroup; private String vault; 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/keyvault/KeyVaultSecretFinder.java b/src/main/java/gyro/azure/keyvault/KeyVaultSecretFinder.java index d30a964c..39978782 100644 --- a/src/main/java/gyro/azure/keyvault/KeyVaultSecretFinder.java +++ b/src/main/java/gyro/azure/keyvault/KeyVaultSecretFinder.java @@ -37,7 +37,7 @@ * certificate: $(external-query azure::key-vault-secret {resource-group: "resource-group-example", vault: "vault-example", name: "secret-example"}) */ @Type("key-vault-secret") -public class KeyVaultSecretFinder extends AzureFinder { +public class KeyVaultSecretFinder extends AzureFinder { private String resourceGroup; private String vault; diff --git a/src/main/java/gyro/azure/network/ApplicationGatewayFinder.java b/src/main/java/gyro/azure/network/ApplicationGatewayFinder.java index 13b1d873..e2529487 100644 --- a/src/main/java/gyro/azure/network/ApplicationGatewayFinder.java +++ b/src/main/java/gyro/azure/network/ApplicationGatewayFinder.java @@ -38,7 +38,7 @@ */ @Type("application-gateway") public class ApplicationGatewayFinder - extends AzureFinder { + extends AzureFinder { private String id; 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/ApplicationSecurityGroupFinder.java b/src/main/java/gyro/azure/network/ApplicationSecurityGroupFinder.java index 729f4702..aae02700 100644 --- a/src/main/java/gyro/azure/network/ApplicationSecurityGroupFinder.java +++ b/src/main/java/gyro/azure/network/ApplicationSecurityGroupFinder.java @@ -38,7 +38,7 @@ */ @Type("application-security-group") public class ApplicationSecurityGroupFinder - extends AzureFinder { + extends AzureFinder { private String id; 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/LoadBalancerFinder.java b/src/main/java/gyro/azure/network/LoadBalancerFinder.java index d9c9246a..a70c624d 100644 --- a/src/main/java/gyro/azure/network/LoadBalancerFinder.java +++ b/src/main/java/gyro/azure/network/LoadBalancerFinder.java @@ -37,7 +37,7 @@ * load-balancer: $(external-query azure::load-balancer {}) */ @Type("load-balancer") -public class LoadBalancerFinder extends AzureFinder { +public class LoadBalancerFinder extends AzureFinder { private String id; 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/NetworkFinder.java b/src/main/java/gyro/azure/network/NetworkFinder.java index 11fe1bda..4bea3e55 100644 --- a/src/main/java/gyro/azure/network/NetworkFinder.java +++ b/src/main/java/gyro/azure/network/NetworkFinder.java @@ -37,7 +37,7 @@ * network: $(external-query azure::network {}) */ @Type("network") -public class NetworkFinder extends AzureFinder { +public class NetworkFinder extends AzureFinder { private String id; diff --git a/src/main/java/gyro/azure/network/NetworkInterfaceFinder.java b/src/main/java/gyro/azure/network/NetworkInterfaceFinder.java index 0ef56833..c2373132 100644 --- a/src/main/java/gyro/azure/network/NetworkInterfaceFinder.java +++ b/src/main/java/gyro/azure/network/NetworkInterfaceFinder.java @@ -37,7 +37,7 @@ * network-interface: $(external-query azure::network-interface {}) */ @Type("network-interface") -public class NetworkInterfaceFinder extends AzureFinder { +public class NetworkInterfaceFinder extends AzureFinder { private String id; 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/NetworkSecurityGroupFinder.java b/src/main/java/gyro/azure/network/NetworkSecurityGroupFinder.java index 0f2b70d0..9b3e1b73 100644 --- a/src/main/java/gyro/azure/network/NetworkSecurityGroupFinder.java +++ b/src/main/java/gyro/azure/network/NetworkSecurityGroupFinder.java @@ -38,7 +38,7 @@ */ @Type("network-security-group") public class NetworkSecurityGroupFinder - extends AzureFinder { + extends AzureFinder { private String id; 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/PublicIpAddressFinder.java b/src/main/java/gyro/azure/network/PublicIpAddressFinder.java index 61e4c2e7..f66b4727 100644 --- a/src/main/java/gyro/azure/network/PublicIpAddressFinder.java +++ b/src/main/java/gyro/azure/network/PublicIpAddressFinder.java @@ -37,7 +37,7 @@ * public-ip-address: $(external-query azure::public-ip-address {}) */ @Type("public-ip-address") -public class PublicIpAddressFinder extends AzureFinder { +public class PublicIpAddressFinder extends AzureFinder { private String id; 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/RouteTableFinder.java b/src/main/java/gyro/azure/network/RouteTableFinder.java index f9cbc5a2..a5738e2b 100644 --- a/src/main/java/gyro/azure/network/RouteTableFinder.java +++ b/src/main/java/gyro/azure/network/RouteTableFinder.java @@ -37,7 +37,7 @@ * route-table: $(external-query azure::route-table {}) */ @Type("route-table") -public class RouteTableFinder extends AzureFinder { +public class RouteTableFinder extends AzureFinder { private String id; 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/RegistryFinder.java b/src/main/java/gyro/azure/registries/RegistryFinder.java index 8ddfd5e2..29357660 100644 --- a/src/main/java/gyro/azure/registries/RegistryFinder.java +++ b/src/main/java/gyro/azure/registries/RegistryFinder.java @@ -37,7 +37,7 @@ * registry: $(external-query azure::registry {}) */ @Type("registry") -public class RegistryFinder extends AzureFinder { +public class RegistryFinder extends AzureFinder { private String id; 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/ResourceGroupFinder.java b/src/main/java/gyro/azure/resources/ResourceGroupFinder.java index 5deb8fc8..ea6658c4 100644 --- a/src/main/java/gyro/azure/resources/ResourceGroupFinder.java +++ b/src/main/java/gyro/azure/resources/ResourceGroupFinder.java @@ -37,7 +37,7 @@ * resource-group: $(external-query azure::resource-group {}) */ @Type("resource-group") -public class ResourceGroupFinder extends AzureFinder { +public class ResourceGroupFinder extends AzureFinder { private String name; /** 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/SqlDatabaseFinder.java b/src/main/java/gyro/azure/sql/SqlDatabaseFinder.java index 43738515..283a10af 100644 --- a/src/main/java/gyro/azure/sql/SqlDatabaseFinder.java +++ b/src/main/java/gyro/azure/sql/SqlDatabaseFinder.java @@ -39,7 +39,7 @@ * sql-database: $(external-query azure::sql-database {}) */ @Type("sql-database") -public class SqlDatabaseFinder extends AzureFinder { +public class SqlDatabaseFinder extends AzureFinder { private String sqlServerId; private String name; 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/SqlElasticPoolFinder.java b/src/main/java/gyro/azure/sql/SqlElasticPoolFinder.java index 361fd996..0ee8cd91 100644 --- a/src/main/java/gyro/azure/sql/SqlElasticPoolFinder.java +++ b/src/main/java/gyro/azure/sql/SqlElasticPoolFinder.java @@ -39,7 +39,7 @@ * sql-elastic-pool: $(external-query azure::sql-elastic-pool {}) */ @Type("sql-elastic-pool") -public class SqlElasticPoolFinder extends AzureFinder { +public class SqlElasticPoolFinder extends AzureFinder { private String sqlServerId; private String name; 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/SqlFailoverGroupFinder.java b/src/main/java/gyro/azure/sql/SqlFailoverGroupFinder.java index 3ee123f8..368b7d08 100644 --- a/src/main/java/gyro/azure/sql/SqlFailoverGroupFinder.java +++ b/src/main/java/gyro/azure/sql/SqlFailoverGroupFinder.java @@ -39,7 +39,7 @@ * sql-failover-group: $(external-query azure::sql-failover-group {}) */ @Type("sql-failover-group") -public class SqlFailoverGroupFinder extends AzureFinder { +public class SqlFailoverGroupFinder extends AzureFinder { private String sqlServerId; private String name; 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/SqlFirewallRuleFinder.java b/src/main/java/gyro/azure/sql/SqlFirewallRuleFinder.java index 6f36493b..b37430f8 100644 --- a/src/main/java/gyro/azure/sql/SqlFirewallRuleFinder.java +++ b/src/main/java/gyro/azure/sql/SqlFirewallRuleFinder.java @@ -39,7 +39,7 @@ * sql-firewall-rule: $(external-query azure::sql-firewall-rule {}) */ @Type("sql-firewall-rule") -public class SqlFirewallRuleFinder extends AzureFinder { +public class SqlFirewallRuleFinder extends AzureFinder { private String sqlServerId; private String name; 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/SqlServerFinder.java b/src/main/java/gyro/azure/sql/SqlServerFinder.java index fa8fe383..edc16bac 100644 --- a/src/main/java/gyro/azure/sql/SqlServerFinder.java +++ b/src/main/java/gyro/azure/sql/SqlServerFinder.java @@ -37,7 +37,7 @@ * sql-server: $(external-query azure::sql-server {}) */ @Type("sql-server") -public class SqlServerFinder extends AzureFinder { +public class SqlServerFinder extends AzureFinder { private String id; 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/SqlVirtualNetworkRuleFinder.java b/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleFinder.java index 56435f74..0164a431 100644 --- a/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleFinder.java +++ b/src/main/java/gyro/azure/sql/SqlVirtualNetworkRuleFinder.java @@ -40,7 +40,7 @@ */ @Type("sql-virtual-network-rule") public class SqlVirtualNetworkRuleFinder - extends AzureFinder { + extends AzureFinder { private String sqlServerId; private String name; 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/StorageAccountFinder.java b/src/main/java/gyro/azure/storage/StorageAccountFinder.java index f406e694..fb7d5704 100644 --- a/src/main/java/gyro/azure/storage/StorageAccountFinder.java +++ b/src/main/java/gyro/azure/storage/StorageAccountFinder.java @@ -28,7 +28,7 @@ import gyro.core.Type; @Type("storage-account") -public class StorageAccountFinder extends AzureFinder { +public class StorageAccountFinder extends AzureFinder { private String id; private String resourceGroup; 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());